diff --git a/.gitignore b/.gitignore
index d2c8c7f2..7077ec49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
node_modules
npm-debug.log
-src/extensions/ezEditTable
-dist/extensions/ezEditTable
+build
*.js.map
.codio
.settings
diff --git a/Gruntfile.js b/Gruntfile.js
index 4f1f92ca..86040c2b 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,8 +1,9 @@
module.exports = function (grunt) {
- var webpack = require("webpack");
- // var webpackConfig = require("./webpack.config.js");
- var path = require("path");
+ var webpack = require('webpack');
+ var webpackConfig = require('./webpack.config.js');
+ var pkg = grunt.file.readJSON('package.json');
+ var version = pkg.version;
grunt.initConfig({
@@ -20,22 +21,39 @@ module.exports = function (grunt) {
files: ['test/**/*.html']
},
- "webpack-dev-server": {
+ copy: {
+ build: {
+ src: ['**'],
+ cwd: 'static/style',
+ dest: 'build/tablefilter',
+ expand: true
+ },
+ dist: {
+ src: ['**'],
+ cwd: 'static/style',
+ dest: 'dist/tablefilter',
+ expand: true
+ }
+ },
+
+ 'webpack-dev-server': {
options: {
webpack: webpack.dev,
- publicPath: "/src/"
+ publicPath: '/dev/'
},
start: {
keepAlive: true,
webpack: {
- devtool: "eval",
+ devtool: 'eval',
debug: true
}
}
},
webpack: {
- // "dev": {
+ dist: webpackConfig.dist,
+ build: webpackConfig.build
+ // 'dev': {
// entry: __dirname + '/src-es6/tablefilter.js',
// // entry: {
// // tablefilter: __dirname + '/src-es6/tablefilter.js',
@@ -43,10 +61,10 @@ module.exports = function (grunt) {
// // '/src-es6/extensions/colsVisibility/colsVisibility.js'
// // },
// output: {
- // publicPath: "/src/",
- // path: __dirname + "/src",
- // filename: "tablefilter.js",
- // chunkFilename: "[name].js",
+ // publicPath: '/src/',
+ // path: __dirname + '/src',
+ // filename: 'tablefilter.js',
+ // chunkFilename: '[name].js',
// libraryTarget: 'umd'
// },
// resolve: {
@@ -62,60 +80,9 @@ module.exports = function (grunt) {
// loader: 'babel-loader'
// }]
// },
- // devtool: "sourcemap",
+ // devtool: 'sourcemap',
// debug: true
// },
- "build": {
- entry: __dirname + '/src-es6/tablefilter.js',
- // entry: {
- // tablefilter: __dirname + '/src-es6/tablefilter.js',
- // sortabletable: __dirname + '/libs/sortabletable.js'
- // },
- output: {
- publicPath: "/dist/",
- path: __dirname + "/dist",
- filename: "tablefilter.js",
- // chunkFilename: "[name]-[chunkhash].js",
- chunkFilename: "[name].js",
- libraryTarget: 'umd'
- },
- resolve: {
- extensions: ['', '.js'],
- alias: {
- sortabletable: "../../../libs/sortabletable.js"
- // ,
- // adapterSortabletable:
- // './extensions/sortabletable/adapterSortabletable'
- }
- },
- // externals: {
- // 'sortabletable': "SortableTable"
- // },
- module: {
- loaders: [{
- test: path.join(__dirname, 'src-es6'),
- exclude: /node_modules/,
- query: {
- compact: false
- },
- loader: 'babel-loader'
- }]
- },
- plugins: [
- // new webpack.DefinePlugin({
- // "process.env": {
- // // This has effect on the react lib size
- // "NODE_ENV": JSON.stringify("production")
- // }
- // }),
- // new webpack.IgnorePlugin(/adapterSortabletable$/),
- new webpack.optimize.DedupePlugin(),
- new webpack.optimize.MinChunkSizePlugin(
- {minChunkSize: 10000})
- // ,
- // new webpack.optimize.UglifyJsPlugin()
- ]
- }
},
babel: {
@@ -129,7 +96,7 @@ module.exports = function (grunt) {
expand: true,
cwd: 'src-es6',
src: ['**/*.js'],
- dest: 'dev'
+ dest: 'dev/tablefilter'
}]
}
}
@@ -138,20 +105,21 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
+ grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-webpack');
grunt.loadNpmTasks('grunt-babel');
// The development server (the recommended option for development)
- grunt.registerTask("default", ["webpack-dev-server:start"]);
+ grunt.registerTask('dev-server', ['webpack-dev-server:start']);
// Build and watch cycle (another option for development)
// Advantage: No server required, can run app from filesystem
// Disadvantage: Requests are not blocked until bundle is available,
// can serve an old app on too fast refresh
- grunt.registerTask("dev", ["webpack:dev"/*, "watch:app"*/]);
+ grunt.registerTask('dev', ['jshint', 'webpack:build', 'copy:build'/*, 'watch:app'*/]);
// Production build
- grunt.registerTask("build", ['jshint', "webpack:build"]);
+ grunt.registerTask('dist', ['jshint', 'webpack:dist', 'copy:dist']);
// Tests
grunt.registerTask('test', ['qunit']);
diff --git a/dev/array.js b/dev/array.js
deleted file mode 100644
index de43f1a2..00000000
--- a/dev/array.js
+++ /dev/null
@@ -1,30 +0,0 @@
-define(['exports', './string'], function (exports, _string) {
- 'use strict';
-
- var Arr = {
- has: function has(arr, val, caseSensitive) {
- var sCase = caseSensitive === undefined ? false : caseSensitive;
- for (var i = 0; i < arr.length; i++) {
- if (_string.Str.matchCase(arr[i].toString(), sCase) == val) {
- return true;
- }
- }
- return false;
- },
- indexByValue: function indexByValue(arr, val, caseSensitive) {
- var sCase = caseSensitive === undefined ? false : caseSensitive;
- for (var i = 0; i < arr.length; i++) {
- if (_string.Str.matchCase(arr[i].toString(), sCase) == val) {
- return i;
- }
- }
- return -1;
- }
- };
-
- exports.Arr = Arr;
-});
-/**
- * Array utilities
- */
-//# sourceMappingURL=array.js.map
\ No newline at end of file
diff --git a/dev/cookie.js b/dev/cookie.js
deleted file mode 100644
index 7fb5d914..00000000
--- a/dev/cookie.js
+++ /dev/null
@@ -1,63 +0,0 @@
-define(['exports'], function (exports) {
- /**
- * Cookie utilities
- */
-
- 'use strict';
-
- var Cookie = {};
-
- Cookie.write = function (name, value, hours) {
- var expire = '';
- if (hours) {
- expire = new Date(new Date().getTime() + hours * 3600000);
- expire = '; expires=' + expire.toGMTString();
- }
- document.cookie = name + '=' + escape(value) + expire;
- };
-
- Cookie.read = function (name) {
- var cookieValue = '',
- search = name + '=';
- if (document.cookie.length > 0) {
- var cookie = document.cookie,
- offset = cookie.indexOf(search);
- if (offset !== -1) {
- offset += search.length;
- var end = cookie.indexOf(';', offset);
- if (end === -1) {
- end = cookie.length;
- }
- cookieValue = unescape(cookie.substring(offset, end));
- }
- }
- return cookieValue;
- };
-
- Cookie.remove = function (name) {
- this.write(name, '', -1);
- };
-
- Cookie.valueToArray = function (name, separator) {
- if (!separator) {
- separator = ',';
- }
- //reads the cookie
- var val = this.read(name);
- //creates an array with filters' values
- var arr = val.split(separator);
- return arr;
- };
-
- Cookie.getValueByIndex = function (name, index, separator) {
- if (!separator) {
- separator = ',';
- }
- //reads the cookie
- var val = this.valueToArray(name, separator);
- return val[index];
- };
-
- exports.Cookie = Cookie;
-});
-//# sourceMappingURL=cookie.js.map
\ No newline at end of file
diff --git a/dev/date.js b/dev/date.js
deleted file mode 100644
index 72a9bae4..00000000
--- a/dev/date.js
+++ /dev/null
@@ -1,172 +0,0 @@
-define(['exports'], function (exports) {
- /**
- * Date utilities
- */
-
- 'use strict';
-
- var DateHelper = {
- isValid: function isValid(dateStr, format) {
- if (!format) {
- format = 'DMY';
- }
- format = format.toUpperCase();
- if (format.length != 3) {
- if (format === 'DDMMMYYYY') {
- var d = this.format(dateStr, format);
- dateStr = d.getDate() + '/' + (d.getMonth() + 1) + '/' + d.getFullYear();
- format = 'DMY';
- }
- }
- if (format.indexOf('M') === -1 || format.indexOf('D') === -1 || format.indexOf('Y') === -1) {
- format = 'DMY';
- }
- var reg1, reg2;
- // If the year is first
- if (format.substring(0, 1) == 'Y') {
- reg1 = /^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/;
- reg2 = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/;
- } else if (format.substring(1, 2) == 'Y') {
- // If the year is second
- reg1 = /^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/;
- reg2 = /^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/;
- } else {
- // The year must be third
- reg1 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/;
- reg2 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/;
- }
- // If it doesn't conform to the right format (with either a 2 digit year or
- // 4 digit year), fail
- if (reg1.test(dateStr) === false && reg2.test(dateStr) === false) {
- return false;
- }
- // Split into 3 parts based on what the divider was
- var parts = dateStr.split(RegExp.$1);
- var mm, dd, yy;
- // Check to see if the 3 parts end up making a valid date
- if (format.substring(0, 1) === 'M') {
- mm = parts[0];
- } else if (format.substring(1, 2) === 'M') {
- mm = parts[1];
- } else {
- mm = parts[2];
- }
- if (format.substring(0, 1) === 'D') {
- dd = parts[0];
- } else if (format.substring(1, 2) === 'D') {
- dd = parts[1];
- } else {
- dd = parts[2];
- }
- if (format.substring(0, 1) === 'Y') {
- yy = parts[0];
- } else if (format.substring(1, 2) === 'Y') {
- yy = parts[1];
- } else {
- yy = parts[2];
- }
- if (parseInt(yy, 10) <= 50) {
- yy = (parseInt(yy, 10) + 2000).toString();
- }
- if (parseInt(yy, 10) <= 99) {
- yy = (parseInt(yy, 10) + 1900).toString();
- }
- var dt = new Date(parseInt(yy, 10), parseInt(mm, 10) - 1, parseInt(dd, 10), 0, 0, 0, 0);
- if (parseInt(dd, 10) != dt.getDate()) {
- return false;
- }
- if (parseInt(mm, 10) - 1 != dt.getMonth()) {
- return false;
- }
- return true;
- },
- format: (function (_format) {
- function format(_x, _x2) {
- return _format.apply(this, arguments);
- }
-
- format.toString = function () {
- return _format.toString();
- };
-
- return format;
- })(function (dateStr, format) {
- if (!format) {
- format = 'DMY';
- }
- if (!dateStr || dateStr === '') {
- return new Date(1001, 0, 1);
- }
- var oDate, parts;
-
- function y2kDate(yr) {
- if (yr === undefined) {
- return 0;
- }
- if (yr.length > 2) {
- return yr;
- }
- var y;
- //>50 belong to 1900
- if (yr <= 99 && yr > 50) {
- y = '19' + yr;
- }
- //<50 belong to 2000
- if (yr < 50 || yr === '00') {
- y = '20' + yr;
- }
- return y;
- }
-
- function mmm2mm(mmm) {
- if (mmm === undefined) {
- return 0;
- }
- var mondigit;
- var MONTH_NAMES = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december', 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
- for (var m_i = 0; m_i < MONTH_NAMES.length; m_i++) {
- var month_name = MONTH_NAMES[m_i];
- if (mmm.toLowerCase() === month_name) {
- mondigit = m_i + 1;
- break;
- }
- }
- if (mondigit > 11 || mondigit < 23) {
- mondigit = mondigit - 12;
- }
- if (mondigit < 1 || mondigit > 12) {
- return 0;
- }
- return mondigit;
- }
-
- switch (format.toUpperCase()) {
- case 'DDMMMYYYY':
- parts = dateStr.replace(/[- \/.]/g, ' ').split(' ');
- oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]);
- break;
- case 'DMY':
- parts = dateStr.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, '$1 $3 $5').split(' ');
- oDate = new Date(y2kDate(parts[2]), parts[1] - 1, parts[0]);
- break;
- case 'MDY':
- parts = dateStr.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/, '$1 $3 $5').split(' ');
- oDate = new Date(y2kDate(parts[2]), parts[0] - 1, parts[1]);
- break;
- case 'YMD':
- parts = dateStr.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/, '$1 $4 $6').split(' ');
- oDate = new Date(y2kDate(parts[0]), parts[1] - 1, parts[2]);
- break;
- default:
- //in case format is not correct
- parts = dateStr.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, '$1 $3 $5').split(' ');
- oDate = new Date(y2kDate(parts[2]), parts[1] - 1, parts[0]);
- break;
- }
- return oDate;
- })
- };
-
- exports.DateHelper = DateHelper;
-});
-//# sourceMappingURL=date.js.map
\ No newline at end of file
diff --git a/dev/dom.js b/dev/dom.js
deleted file mode 100644
index 10d61310..00000000
--- a/dev/dom.js
+++ /dev/null
@@ -1,162 +0,0 @@
-define(['exports'], function (exports) {
- /**
- * DOM utilities
- */
-
- 'use strict';
-
- var Dom = {};
-
- /**
- * Returns text + text of children of given node
- * @param {NodeElement} node
- * @return {String}
- */
- Dom.getText = function (node) {
- var s = node.textContent || node.innerText || node.innerHTML.replace(/<[^<>]+>/g, '');
- s = s.replace(/^\s+/, '').replace(/\s+$/, '');
- return s;
- };
-
- /**
- * Creates an html element with given collection of attributes
- * @param {String} tag a string of the html tag to create
- * @param {Array} an undetermined number of arrays containing the with 2
- * items, the attribute name and its value ['id','myId']
- * @return {Object} created element
- */
- Dom.create = function (tag) {
- if (!tag || tag === '') {
- return;
- }
-
- var el = document.createElement(tag),
- args = arguments;
-
- if (args.length > 1) {
- for (var i = 0; i < args.length; i++) {
- var argtype = typeof args[i];
- if (argtype.toLowerCase() === 'object' && args[i].length === 2) {
- el.setAttribute(args[i][0], args[i][1]);
- }
- }
- }
- return el;
- };
-
- /**
- * Returns a text node with given text
- * @param {String} text
- * @return {Object}
- */
- Dom.text = function (text) {
- return document.createTextNode(text);
- };
-
- /**
- * Returns offset position of passed element
- * @param {object} obj [description]
- * @return {object} literal object with left and top values
- */
- Dom.position = function (obj) {
- var l = 0,
- t = 0;
- if (obj && obj.offsetParent) {
- do {
- l += obj.offsetLeft;
- t += obj.offsetTop;
- } while (obj == obj.offsetParent);
- }
- return { left: l, top: t };
- };
-
- Dom.hasClass = function (ele, cls) {
- if (!ele) {
- return false;
- }
-
- if (supportsClassList()) {
- return ele.classList.contains(cls);
- }
- return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
- };
-
- Dom.addClass = function (ele, cls) {
- if (!ele) {
- return;
- }
-
- if (supportsClassList()) {
- ele.classList.add(cls);
- return;
- }
-
- if (ele.className === '') {
- ele.className = cls;
- } else if (!this.hasClass(ele, cls)) {
- ele.className += ' ' + cls;
- }
- };
-
- Dom.removeClass = function (ele, cls) {
- if (!ele) {
- return;
- }
-
- if (supportsClassList()) {
- ele.classList.remove(cls);
- return;
- }
- var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)', 'g');
- ele.className = ele.className.replace(reg, '');
- };
-
- /**
- * Creates and returns an option element
- * @param {String} text option text
- * @param {String} value option value
- * @param {Boolean} isSel whether option is selected
- * @return {Object} option element
- */
- Dom.createOpt = function (text, value, isSel) {
- var isSelected = isSel ? true : false,
- opt = isSelected ? this.create('option', ['value', value], ['selected', 'true']) : this.create('option', ['value', value]);
- opt.appendChild(this.text(text));
- return opt;
- };
-
- /**
- * Creates and returns a checklist item
- * @param {Number} chkIndex index of check item
- * @param {String} chkValue check item value
- * @param {String} labelText check item label text
- * @return {Object} li DOM element
- */
- Dom.createCheckItem = function (chkIndex, chkValue, labelText) {
- var li = this.create('li'),
- label = this.create('label', ['for', chkIndex]),
- check = this.create('input', ['id', chkIndex], ['name', chkIndex], ['type', 'checkbox'], ['value', chkValue]);
- label.appendChild(check);
- label.appendChild(this.text(labelText));
- li.appendChild(label);
- li.label = label;
- li.check = check;
- return li;
- };
-
- Dom.id = function (id) {
- return document.getElementById(id);
- };
-
- Dom.tag = function (o, tagname) {
- return o.getElementsByTagName(tagname);
- };
-
- // HTML5 classList API
- function supportsClassList() {
- return document.documentElement.classList;
- }
-
- exports.Dom = Dom;
-});
-//# sourceMappingURL=dom.js.map
\ No newline at end of file
diff --git a/dev/event.js b/dev/event.js
deleted file mode 100644
index 9bdd59c8..00000000
--- a/dev/event.js
+++ /dev/null
@@ -1,57 +0,0 @@
-define(['exports'], function (exports) {
- /**
- * DOM event utilities
- */
-
- 'use strict';
-
- var Event = {
- add: function add(obj, type, func, capture) {
- if (obj.addEventListener) {
- obj.addEventListener(type, func, capture);
- } else if (obj.attachEvent) {
- obj.attachEvent('on' + type, func);
- } else {
- obj['on' + type] = func;
- }
- },
- remove: function remove(obj, type, func, capture) {
- if (obj.detachEvent) {
- obj.detachEvent('on' + type, func);
- } else if (obj.removeEventListener) {
- obj.removeEventListener(type, func, capture);
- } else {
- obj['on' + type] = null;
- }
- },
- stop: function stop(evt) {
- if (!evt) {
- evt = window.event;
- }
- if (evt.stopPropagation) {
- evt.stopPropagation();
- } else {
- evt.cancelBubble = true;
- }
- },
- cancel: function cancel(evt) {
- if (!evt) {
- evt = window.event;
- }
- if (evt.preventDefault) {
- evt.preventDefault();
- } else {
- evt.returnValue = false;
- }
- },
- target: function target(evt) {
- return evt && evt.target || window.event && window.event.srcElement;
- },
- keyCode: function keyCode(evt) {
- return evt.charCode ? evt.charCode : evt.keyCode ? evt.keyCode : evt.which ? evt.which : 0;
- }
- };
-
- exports.Event = Event;
-});
-//# sourceMappingURL=event.js.map
\ No newline at end of file
diff --git a/dev/extensions/colsVisibility/colsVisibility.js b/dev/extensions/colsVisibility/colsVisibility.js
deleted file mode 100644
index 397fd0dc..00000000
--- a/dev/extensions/colsVisibility/colsVisibility.js
+++ /dev/null
@@ -1,579 +0,0 @@
-define(['exports', 'module', '../../dom', '../../types', '../../event', '../../helpers', '../../array'], function (exports, module, _dom, _types, _event, _helpers, _array) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- var ColsVisibility = (function () {
-
- /**
- * Columns Visibility extension
- * @param {Object} tf TableFilter instance
- */
-
- function ColsVisibility(tf) {
- var ext = arguments[1] === undefined ? {
- name: 'colsVisibility',
- description: 'Columns visibility manager'
- } : arguments[1];
-
- _classCallCheck(this, ColsVisibility);
-
- // Configuration object
- var f = ext;
- var cfg = tf.config();
-
- this.initialized = false;
- this.extName = f.name;
- this.extDesc = f.description;
-
- //show/hide cols span element
- this.spanEl = null;
- //show/hide cols button element
- this.btnEl = null;
- //show/hide cols container div element
- this.contEl = null;
-
- //tick to hide or show column
- this.tickToHide = f.tick_to_hide === false ? false : true;
- //enables/disables cols manager generation
- this.manager = f.manager === false ? false : true;
- //only if external headers
- this.headersTbl = f.headers_table || false;
- //only if external headers
- this.headersIndex = f.headers_index || 1;
- //id of container element
- this.contElTgtId = f.container_target_id || null;
- //alternative headers text
- this.headersText = f.headers_text || null;
- //id of button container element
- this.btnTgtId = f.btn_target_id || null;
- //defines show/hide cols text
- this.btnText = f.btn_text || 'Columns▼';
- //defines show/hide cols button innerHtml
- this.btnHtml = f.btn_html || null;
- //defines css class for show/hide cols button
- this.btnCssClass = f.btn_css_class || 'colVis';
- //defines close link text
- this.btnCloseText = f.btn_close_text || 'Close';
- //defines close button innerHtml
- this.btnCloseHtml = f.btn_close_html || null;
- //defines css class for close button
- this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass;
-
- this.path = f.path || tf.extensionsPath + 'colsVisibility/';
- this.stylesheet = f.stylesheet || 'colsVisibility.css';
- //span containing show/hide cols button
- this.prfx = 'colVis_';
- //defines css class span containing show/hide cols
- this.spanCssClass = f.span_css_class || 'colVisSpan';
- this.prfxCont = this.prfx + 'Cont_';
- //defines css class div containing show/hide cols
- this.contCssClass = f.cont_css_class || 'colVisCont';
- //defines css class for cols list (ul)
- this.listCssClass = cfg.list_css_class || 'cols_checklist';
- //defines css class for list item (li)
- this.listItemCssClass = cfg.checklist_item_css_class || 'cols_checklist_item';
- //defines css class for selected list item (li)
- this.listSlcItemCssClass = cfg.checklist_selected_item_css_class || 'cols_checklist_slc_item';
- //text preceding columns list
- this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: ');
- this.atStart = f.at_start || null;
- this.enableHover = Boolean(f.enable_hover);
- //enables select all option
- this.enableTickAll = Boolean(f.enable_tick_all);
- //text preceding columns list
- this.tickAllText = f.tick_all_text || 'Select all:';
-
- //array containing hidden columns indexes
- this.hiddenCols = [];
- this.tblHasColTag = _dom.Dom.tag(tf.tbl, 'col').length > 0;
-
- //callback invoked just after cols manager is loaded
- this.onLoaded = _types.Types.isFn(f.on_loaded) ? f.on_loaded : null;
- //calls function before cols manager is opened
- this.onBeforeOpen = _types.Types.isFn(f.on_before_open) ? f.on_before_open : null;
- //calls function after cols manager is opened
- this.onAfterOpen = _types.Types.isFn(f.on_after_open) ? f.on_after_open : null;
- //calls function before cols manager is closed
- this.onBeforeClose = _types.Types.isFn(f.on_before_close) ? f.on_before_close : null;
- //calls function after cols manager is closed
- this.onAfterClose = _types.Types.isFn(f.on_after_close) ? f.on_after_close : null;
-
- //calls function before col is hidden
- this.onBeforeColHidden = _types.Types.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null;
- //calls function after col is hidden
- this.onAfterColHidden = _types.Types.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null;
- //calls function before col is displayed
- this.onBeforeColDisplayed = _types.Types.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null;
- //calls function after col is displayed
- this.onAfterColDisplayed = _types.Types.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null;
-
- //Grid layout compatibility
- if (tf.gridLayout) {
- this.headersTbl = tf.Cpt.gridLayout.headTbl; //headers table
- this.headersIndex = 0; //headers index
- this.onAfterColDisplayed = function () {};
- this.onAfterColHidden = function () {};
- }
-
- //Loads extension stylesheet
- tf.includeFile(f.name + 'Style', this.path + '/' + this.stylesheet, null, 'link');
-
- this.tf = tf;
- }
-
- _createClass(ColsVisibility, [{
- key: 'toggle',
- value: function toggle(evt) {
- var tf = this.tf;
- var contDisplay = this.contEl.style.display;
- var onBeforeOpen = this.onBeforeOpen;
- var onBeforeClose = this.onBeforeClose;
- var onAfterOpen = this.onAfterOpen;
- var onAfterClose = this.onAfterClose;
-
- if (onBeforeOpen && contDisplay !== 'inline') {
- onBeforeOpen.call(null, this);
- }
- if (onBeforeClose && contDisplay === 'inline') {
- onBeforeClose.call(null, this);
- }
-
- this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline';
-
- if (onAfterOpen && contDisplay !== 'inline') {
- onAfterOpen.call(null, this);
- }
- if (onAfterClose && contDisplay === 'inline') {
- onAfterClose.call(null, this);
- }
- }
- }, {
- key: 'checkItem',
- value: function checkItem(lbl) {
- var li = lbl.parentNode;
- if (!li || !lbl) {
- return;
- }
- var isChecked = lbl.firstChild.checked;
- var colIndex = lbl.firstChild.getAttribute('id').split('_')[1];
- colIndex = parseInt(colIndex, 10);
- if (isChecked) {
- _dom.Dom.addClass(li, this.listSlcItemCssClass);
- } else {
- _dom.Dom.removeClass(li, this.listSlcItemCssClass);
- }
-
- var hide = false;
- if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) {
- hide = true;
- }
- this.setHidden(colIndex, hide);
- }
- }, {
- key: 'init',
- value: function init() {
- if (!this.manager) {
- return;
- }
- this.buildBtn();
- this.buildManager();
-
- this.initialized = true;
- }
- }, {
- key: 'buildBtn',
-
- /**
- * Build main button UI
- */
- value: function buildBtn() {
- var _this = this;
-
- if (this.btnEl) {
- return;
- }
- var tf = this.tf;
- var span = _dom.Dom.create('span', ['id', this.prfx + tf.id]);
- span.className = this.spanCssClass;
-
- //Container element (rdiv or custom element)
- if (!this.btnTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.btnTgtId ? tf.rDiv : _dom.Dom.id(this.btnTgtId);
-
- if (!this.btnTgtId) {
- var firstChild = targetEl.firstChild;
- firstChild.parentNode.insertBefore(span, firstChild);
- } else {
- targetEl.appendChild(span);
- }
-
- if (!this.btnHtml) {
- var btn = _dom.Dom.create('a', ['href', 'javascript:;']);
- btn.className = this.btnCssClass;
- btn.title = this.extDesc;
-
- btn.innerHTML = this.btnText;
- span.appendChild(btn);
- if (!this.enableHover) {
- _event.Event.add(btn, 'click', function (evt) {
- _this.toggle(evt);
- });
- } else {
- _event.Event.add(btn, 'mouseover', function (evt) {
- _this.toggle(evt);
- });
- }
- } else {
- //Custom html
- span.innerHTML = this.btnHtml;
- var colVisEl = span.firstChild;
- if (!this.enableHover) {
- _event.Event.add(colVisEl, 'click', function (evt) {
- _this.toggle(evt);
- });
- } else {
- _event.Event.add(colVisEl, 'mouseover', function (evt) {
- _this.toggle(evt);
- });
- }
- }
-
- this.spanEl = span;
- this.btnEl = this.spanEl.firstChild;
-
- if (this.onLoaded) {
- this.onLoaded.call(null, this);
- }
- }
- }, {
- key: 'buildManager',
-
- /**
- * Build columns manager UI
- */
- value: function buildManager() {
- var _this2 = this;
-
- var tf = this.tf;
-
- var container = !this.contElTgtId ? _dom.Dom.create('div', ['id', this.prfxCont + tf.id]) : _dom.Dom.id(this.contElTgtId);
- container.className = this.contCssClass;
-
- //Extension description
- var extNameLabel = _dom.Dom.create('p');
- extNameLabel.innerHTML = this.text;
- container.appendChild(extNameLabel);
-
- //Headers list
- var ul = _dom.Dom.create('ul', ['id', 'ul' + this.extName + '_' + tf.id]);
- ul.className = this.listCssClass;
-
- var tbl = this.headersTbl ? this.headersTbl : tf.tbl;
- var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex();
- var headerRow = tbl.rows[headerIndex];
-
- //Tick all option
- if (this.enableTickAll) {
- var li = _dom.Dom.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText);
- _dom.Dom.addClass(li, this.listItemCssClass);
- ul.appendChild(li);
- li.check.checked = !this.tickToHide;
-
- _event.Event.add(li.check, 'click', function (evt) {
- for (var h = 0; h < headerRow.cells.length; h++) {
- var itm = _dom.Dom.id('col_' + h + '_' + tf.id);
- if (itm && li.check.checked !== itm.checked) {
- itm.click();
- itm.checked = li.check.checked;
- }
- }
- });
- }
-
- for (var i = 0; i < headerRow.cells.length; i++) {
- var cell = headerRow.cells[i];
- var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell);
- var liElm = _dom.Dom.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText);
- _dom.Dom.addClass(liElm, this.listItemCssClass);
- if (!this.tickToHide) {
- _dom.Dom.addClass(liElm, this.listSlcItemCssClass);
- }
- ul.appendChild(liElm);
- if (!this.tickToHide) {
- liElm.check.checked = true;
- }
-
- _event.Event.add(liElm.check, 'click', function (evt) {
- var elm = _event.Event.target(evt);
- var lbl = elm.parentNode;
- _this2.checkItem(lbl);
- });
- }
-
- //separator
- var p = _dom.Dom.create('p', ['align', 'center']);
- var btn;
- //Close link
- if (!this.btnCloseHtml) {
- btn = _dom.Dom.create('a', ['href', 'javascript:;']);
- btn.className = this.btnCloseCssClass;
- btn.innerHTML = this.btnCloseText;
- _event.Event.add(btn, 'click', function (evt) {
- _this2.toggle(evt);
- });
- p.appendChild(btn);
- } else {
- p.innerHTML = this.btnCloseHtml;
- btn = p.firstChild;
- _event.Event.add(btn, 'click', function (evt) {
- _this2.toggle(evt);
- });
- }
-
- container.appendChild(ul);
- container.appendChild(p);
-
- this.btnEl.parentNode.insertBefore(container, this.btnEl);
- this.contEl = container;
-
- if (this.atStart) {
- var a = this.atStart;
- for (var k = 0; k < a.length; k++) {
- var itm = _dom.Dom.id('col_' + a[k] + '_' + tf.id);
- if (itm) {
- itm.click();
- }
- }
- }
- }
- }, {
- key: 'setHidden',
-
- /**
- * Hide or show specified columns
- * @param {Numner} colIndex Column index
- * @param {Boolean} hide hide column if true or show if false
- */
- value: function setHidden(colIndex, hide) {
- var tf = this.tf;
- var tbl = tf.tbl;
- var col = _dom.Dom.tag(tbl, 'col')[colIndex];
-
- if (this.onBeforeColHidden && hide) {
- this.onBeforeColHidden.call(null, this, colIndex);
- }
- if (this.onBeforeColDisplayed && !hide) {
- this.onBeforeColDisplayed.call(null, this, colIndex);
- }
-
- this._hideCells(tbl, colIndex, hide);
- if (this.headersTbl) {
- this._hideCells(this.headersTbl, colIndex, hide);
- }
-
- var hiddenCols = this.hiddenCols;
- if (hide) {
- if (hiddenCols.indexOf(colIndex) === -1) {
- this.hiddenCols.push(colIndex);
- }
- } else {
- var itemIndex = _array.Arr.indexByValue(hiddenCols, colIndex, true);
- if (hiddenCols.indexOf(colIndex) !== -1) {
- this.hiddenCols.splice(itemIndex, 1);
- }
- }
-
- var gridLayout;
- var headTbl;
- var gridColElms;
- if (this.onAfterColHidden && hide) {
- //This event is fired just after a column is displayed for
- //grid_layout compatibility
- if (tf.gridLayout) {
- gridLayout = tf.Cpt.gridLayout;
- headTbl = gridLayout.headTbl;
- gridColElms = gridLayout.gridColElms;
- if (_helpers.Helpers.isIE()) {
- tbl.style.width = headTbl.clientWidth + 'px';
- } else {
- var ths = headTbl.rows[this.headersIndex].cells;
- var hiddenWidth = 0;
- for (var i = 0; i < tf.nbCells; i++) {
- if (ths[i].style.display === 'none') {
- var w = parseInt(ths[i].style.width, 10);
- ths[i].style.width = 0;
- hiddenWidth += w;
- }
- }
- var headTblW = parseInt(headTbl.style.width, 10);
-
- headTbl.style.width = headTblW - hiddenWidth + 'px';
- tbl.style.width = headTbl.style.width;
- gridColElms[colIndex].style.display = 'none';
- }
- }
- this.onAfterColHidden.call(null, this, colIndex);
- }
-
- if (this.onAfterColDisplayed && !hide) {
- //This event is fired just after a column is displayed for
- //grid_layout compatibility
- if (tf.gridLayout) {
- gridLayout = tf.Cpt.gridLayout;
- headTbl = gridLayout.headTbl;
- gridColElms = gridLayout.gridColElms;
- gridColElms[colIndex].style.display = '';
- var width = parseInt(gridColElms[colIndex].style.width, 10);
- var header = tf.getHeaderElement(colIndex);
- header.style.width = width + 'px';
- headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px';
- tf.tbl.style.width = headTbl.style.width;
- }
- this.onAfterColDisplayed.call(null, this, colIndex);
- }
- }
- }, {
- key: 'showCol',
-
- /**
- * Show specified column
- * @param {Number} colIndex Column index
- */
- value: function showCol(colIndex) {
- if (colIndex === undefined || !this.isColHidden(colIndex)) {
- return;
- }
- if (this.manager && this.contEl) {
- var itm = _dom.Dom.id('col_' + colIndex + '_' + this.tf.id);
- if (itm) {
- itm.click();
- }
- } else {
- this.setHidden(colIndex, false);
- }
- }
- }, {
- key: 'hideCol',
-
- /**
- * Hide specified column
- * @param {Number} colIndex Column index
- */
- value: function hideCol(colIndex) {
- if (colIndex === undefined || this.isColHidden(colIndex)) {
- return;
- }
- if (this.manager && this.contEl) {
- var itm = _dom.Dom.id('col_' + colIndex + '_' + this.tf.id);
- if (itm) {
- itm.click();
- }
- } else {
- this.setHidden(colIndex, true);
- }
- }
- }, {
- key: 'isColHidden',
-
- /**
- * Determine if specified column is hidden
- * @param {Number} colIndex Column index
- */
- value: function isColHidden(colIndex) {
- if (this.hiddenCols.indexOf(colIndex) !== -1) {
- return true;
- }
- return false;
- }
- }, {
- key: 'toggleCol',
-
- /**
- * Toggle visibility of specified column
- * @param {Number} colIndex Column index
- */
- value: function toggleCol(colIndex) {
- if (colIndex === undefined || this.isColHidden(colIndex)) {
- this.showCol(colIndex);
- } else {
- this.hideCol(colIndex);
- }
- }
- }, {
- key: 'getHiddenCols',
-
- /**
- * Returns the indexes of the columns currently hidden
- * @return {Array} column indexes
- */
- value: function getHiddenCols() {
- return this.hiddenCols;
- }
- }, {
- key: 'destroy',
-
- /**
- * Remove the columns manager
- */
- value: function destroy() {
- if (!this.btnEl || !this.contEl) {
- return;
- }
- if (_dom.Dom.id(this.contElTgtId)) {
- _dom.Dom.id(this.contElTgtId).innerHTML = '';
- } else {
- this.contEl.innerHTML = '';
- this.contEl.parentNode.removeChild(this.contEl);
- this.contEl = null;
- }
- this.btnEl.innerHTML = '';
- this.btnEl.parentNode.removeChild(this.btnEl);
- this.btnEl = null;
- this.initialized = false;
- }
- }, {
- key: '_getHeaderText',
- value: function _getHeaderText(cell) {
- if (!cell.hasChildNodes) {
- return '';
- }
-
- for (var i = 0; i < cell.childNodes.length; i++) {
- var n = cell.childNodes[i];
- if (n.nodeType === 3) {
- return n.nodeValue;
- } else if (n.nodeType === 1) {
- if (n.id && n.id.indexOf('popUp') !== -1) {
- continue;
- } else {
- return _dom.Dom.getText(n);
- }
- }
- continue;
- }
- return '';
- }
- }, {
- key: '_hideCells',
- value: function _hideCells(tbl, colIndex, hide) {
- for (var i = 0; i < tbl.rows.length; i++) {
- var row = tbl.rows[i];
- var cell = row.cells[colIndex];
- if (cell) {
- cell.style.display = hide ? 'none' : '';
- }
- }
- }
- }]);
-
- return ColsVisibility;
- })();
-
- module.exports = ColsVisibility;
-});
-//# sourceMappingURL=colsVisibility.js.map
\ No newline at end of file
diff --git a/dev/extensions/sortabletable/adapterSortabletable.js b/dev/extensions/sortabletable/adapterSortabletable.js
deleted file mode 100644
index 7e97d8e1..00000000
--- a/dev/extensions/sortabletable/adapterSortabletable.js
+++ /dev/null
@@ -1,460 +0,0 @@
-define(['exports', 'module', '../../types', '../../dom', '../../array', '../../event', '../../date', '../../helpers', 'script!sortabletable'], function (exports, module, _types, _dom, _array, _event, _date, _helpers, _scriptSortabletable) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- var AdapterSortableTable = (function () {
-
- /**
- * SortableTable Adapter module
- * @param {Object} tf TableFilter instance
- */
-
- function AdapterSortableTable(tf) {
- _classCallCheck(this, AdapterSortableTable);
-
- // Configuration object
- var f = tf.config();
-
- this.isPaged = false;
-
- //indicates if tables was sorted
- this.sorted = false;
-
- // edit .sort-arrow.descending / .sort-arrow.ascending in filtergrid.css
- // to reflect any path change
- this.sortImgPath = f.sort_images_path || tf.themesPath;
- this.sortImgBlank = f.sort_image_blank || 'blank.png';
- this.sortImgClassName = f.sort_image_class_name || 'sort-arrow';
- this.sortImgAscClassName = f.sort_image_asc_class_name || 'ascending';
- this.sortImgDescClassName = f.sort_image_desc_class_name || 'descending';
- //cell attribute storing custom key
- this.sortCustomKey = f.sort_custom_key || 'data-tf-sortKey';
-
- /*** TF additional events ***/
- //additional paging events for alternating background
- // o.Evt._Paging.nextEvt = function(){ if(o.sorted && o.alternateBgs) o.Filter(); }
- // o.Evt._Paging.prevEvt = o.Evt._Paging.nextEvt;
- // o.Evt._Paging.firstEvt = o.Evt._Paging.nextEvt;
- // o.Evt._Paging.lastEvt = o.Evt._Paging.nextEvt;
- // o.Evt._OnSlcPagesChangeEvt = o.Evt._Paging.nextEvt;
-
- // callback invoked after sort is loaded and instanciated
- this.onSortLoaded = _types.Types.isFn(f.on_sort_loaded) ? f.on_sort_loaded : null;
- // callback invoked before table is sorted
- this.onBeforeSort = _types.Types.isFn(f.on_before_sort) ? f.on_before_sort : null;
- // callback invoked after table is sorted
- this.onAfterSort = _types.Types.isFn(f.on_after_sort) ? f.on_after_sort : null;
-
- this.tf = tf;
- }
-
- _createClass(AdapterSortableTable, [{
- key: 'init',
- value: function init() {
- var tf = this.tf;
- var sortConfig = tf.sortConfig;
- var adpt = this;
-
- // SortableTable class sanity check (sortabletable.js)
- if (_types.Types.isUndef(SortableTable)) {
- throw new Error('SortableTable class not found.');
- }
-
- this.overrideSortableTable();
- this.setSortTypes();
-
- //Column sort at start
- if (sortConfig.sortCol) {
- this.stt.sort(sortConfig.sortCol[0], sortConfig.sortCol[1]);
- }
-
- tf.isSortEnabled = true;
- if (this.onSortLoaded) {
- this.onSortLoaded.call(null, tf, this);
- }
-
- /*** SortableTable callbacks ***/
- this.stt.onbeforesort = function () {
- if (this.onBeforeSort) {
- this.onBeforeSort.call(null, tf, this.stt.sortColumn);
- }
-
- tf.performSort();
-
- /*** sort behaviour for paging ***/
- if (tf.paging) {
- adpt.isPaged = true;
- tf.paging = false;
- tf.Cpt.paging.destroy();
- }
- };
-
- this.stt.onsort = function () {
- adpt.sorted = true;
-
- //rows alternating bg issue
- // TODO: move into AlternateRows component
- if (tf.alternateBgs) {
- var rows = tf.tbl.rows,
- c = 0;
-
- var setClass = function setClass(row, i, removeOnly) {
- if (_types.Types.isUndef(removeOnly)) {
- removeOnly = false;
- }
- var altRows = tf.Cpt.alternateRows,
- oddCls = altRows.oddCss,
- evenCls = altRows.evenCss;
- _dom.Dom.removeClass(row, oddCls);
- _dom.Dom.removeClass(row, evenCls);
-
- if (!removeOnly) {
- _dom.Dom.addClass(row, i % 2 ? oddCls : evenCls);
- }
- };
-
- for (var i = tf.refRow; i < tf.nbRows; i++) {
- var isRowValid = rows[i].getAttribute('validRow');
- if (tf.paging && rows[i].style.display === '') {
- setClass(rows[i], c);
- c++;
- } else {
- if ((isRowValid === 'true' || isRowValid === null) && rows[i].style.display === '') {
- setClass(rows[i], c);
- c++;
- } else {
- setClass(rows[i], c, true);
- }
- }
- }
- }
- //sort behaviour for paging
- if (adpt.isPaged) {
- var paginator = tf.Cpt.paging,
- config = tf.config();
- if (paginator.hasResultsPerPage) {
- var slc = paginator.resultsPerPageSlc;
- config.paging_length = slc.options[slc.selectedIndex].value;
- }
- paginator.addPaging(false);
- paginator.setPage(paginator.currentPageNb);
- adpt.isPaged = false;
- }
-
- if (adpt.onAfterSort) {
- adpt.onAfterSort.call(null, tf, tf.stt.sortColumn);
- }
- };
- }
- }, {
- key: 'sortByColumnIndex',
-
- /**
- * Sort specified column
- * @param {Number} colIdx Column index
- */
- value: function sortByColumnIndex(colIdx) {
- this.stt.sort(colIdx);
- }
- }, {
- key: 'overrideSortableTable',
- value: function overrideSortableTable() {
- var adpt = this,
- tf = this.tf;
-
- /**
- * Overrides headerOnclick method in order to handle th event
- * @param {Object} e [description]
- */
- SortableTable.prototype.headerOnclick = function (evt) {
- if (!tf.sort) {
- return;
- }
- // find Header element
- var el = evt.target || evt.srcElement;
-
- while (el.tagName !== 'TD' && el.tagName !== 'TH') {
- el = el.parentNode;
- }
-
- this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);
- };
-
- /**
- * Overrides getCellIndex IE returns wrong cellIndex when columns are
- * hidden
- * @param {Object} oTd TD element
- * @return {Number} Cell index
- */
- SortableTable.getCellIndex = function (oTd) {
- var cells = oTd.parentNode.cells,
- l = cells.length,
- i;
- for (i = 0; cells[i] != oTd && i < l; i++) {}
- return i;
- };
-
- /**
- * Overrides initHeader in order to handle filters row position
- * @param {Array} oSortTypes
- */
- SortableTable.prototype.initHeader = function (oSortTypes) {
- var stt = this;
- if (!stt.tHead) {
- // throw new Error('Sorting feature requires a THEAD element');
- return;
- }
- stt.headersRow = tf.headersRow;
- var cells = stt.tHead.rows[stt.headersRow].cells;
- var doc = stt.tHead.ownerDocument || stt.tHead.document;
- stt.sortTypes = oSortTypes || [];
- var l = cells.length;
- var img, c;
- for (var i = 0; i < l; i++) {
- c = cells[i];
- if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') {
- c.style.cursor = 'pointer';
- img = _dom.Dom.create('img', ['src', adpt.sortImgPath + adpt.sortImgBlank]);
- c.appendChild(img);
- if (stt.sortTypes[i] !== null) {
- c.setAttribute('_sortType', stt.sortTypes[i]);
- }
- _event.Event.add(c, 'click', stt._headerOnclick);
- } else {
- c.setAttribute('_sortType', oSortTypes[i]);
- c._sortType = 'None';
- }
- }
- stt.updateHeaderArrows();
- };
-
- /**
- * Overrides updateHeaderArrows in order to handle arrows indicators
- */
- SortableTable.prototype.updateHeaderArrows = function () {
- var stt = this;
- var cells, l, img;
- // external headers
- if (tf.sortConfig.asyncSort && tf.sortConfig.triggerIds !== null) {
- var triggers = tf.sortConfig.triggerIds;
- cells = [];
- l = triggers.length;
- for (var j = 0; j < triggers.length; j++) {
- cells.push(_dom.Dom.id(triggers[j]));
- }
- } else {
- if (!this.tHead) {
- return;
- }
- cells = stt.tHead.rows[stt.headersRow].cells;
- l = cells.length;
- }
- for (var i = 0; i < l; i++) {
- var cellAttr = cells[i].getAttribute('_sortType');
- if (cellAttr !== null && cellAttr !== 'None') {
- img = cells[i].lastChild || cells[i];
- if (img.nodeName.toLowerCase() !== 'img') {
- img = _dom.Dom.create('img', ['src', adpt.sortImgPath + adpt.sortImgBlank]);
- cells[i].appendChild(img);
- }
- if (i === stt.sortColumn) {
- img.className = adpt.sortImgClassName + ' ' + (this.descending ? adpt.sortImgDescClassName : adpt.sortImgAscClassName);
- } else {
- img.className = adpt.sortImgClassName;
- }
- }
- }
- };
-
- /**
- * Overrides getRowValue for custom key value feature
- * @param {Object} oRow Row element
- * @param {String} sType
- * @param {Number} nColumn
- * @return {String}
- */
- SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {
- var stt = this;
- // if we have defined a custom getRowValue use that
- var sortTypeInfo = stt._sortTypeInfo[sType];
- if (sortTypeInfo && sortTypeInfo.getRowValue) {
- return sortTypeInfo.getRowValue(oRow, nColumn);
- }
- var c = oRow.cells[nColumn];
- var s = SortableTable.getInnerText(c);
- return stt.getValueFromString(s, sType);
- };
-
- /**
- * Overrides getInnerText in order to avoid Firefox unexpected sorting
- * behaviour with untrimmed text elements
- * @param {Object} oNode DOM element
- * @return {String} DOM element inner text
- */
- SortableTable.getInnerText = function (oNode) {
- if (!oNode) {
- return;
- }
- if (oNode.getAttribute(adpt.sortCustomKey)) {
- return oNode.getAttribute(adpt.sortCustomKey);
- } else {
- return _dom.Dom.getText(oNode);
- }
- };
- }
- }, {
- key: 'addSortType',
- value: function addSortType() {
- SortableTable.prototype.addSortType(arguments[0], arguments[1], arguments[2], arguments[3]);
- }
- }, {
- key: 'setSortTypes',
- value: function setSortTypes() {
- var _this = this;
-
- var tf = this.tf,
- configSort = tf.sortConfig,
- configSortTypes = configSort.sortTypes,
- sortTypes = [];
-
- for (var i = 0; i < tf.nbCells; i++) {
- var colType;
-
- if (configSortTypes !== null && configSortTypes[i] != null) {
- colType = configSortTypes[i].toLowerCase();
- if (colType === 'none') {
- colType = 'None';
- }
- } else {
- // resolve column types
- if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) {
- colType = tf.colNbFormat[i].toLowerCase();
- } else if (tf.hasColDateType && tf.colDateType[i] !== null) {
- colType = tf.colDateType[i].toLowerCase() + 'date';
- } else {
- colType = 'String';
- }
- }
- sortTypes.push(colType);
- }
-
- //Public TF method to add sort type
-
- //Custom sort types
- this.addSortType('number', Number);
- this.addSortType('caseinsensitivestring', SortableTable.toUpperCase);
- this.addSortType('date', SortableTable.toDate);
- this.addSortType('string');
- this.addSortType('us', usNumberConverter);
- this.addSortType('eu', euNumberConverter);
- this.addSortType('dmydate', dmyDateConverter);
- this.addSortType('ymddate', ymdDateConverter);
- this.addSortType('mdydate', mdyDateConverter);
- this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter);
- this.addSortType('ipaddress', ipAddress, sortIP);
-
- this.stt = new SortableTable(tf.tbl, sortTypes);
-
- /*** external table headers adapter ***/
- if (configSort.asyncSort && configSort.triggerIds !== null) {
- var triggers = configSort.triggerIds;
- for (var j = 0; j < triggers.length; j++) {
- if (triggers[j] === null) {
- continue;
- }
- var trigger = _dom.Dom.id(triggers[j]);
- if (trigger) {
- trigger.style.cursor = 'pointer';
-
- _event.Event.add(trigger, 'click', function (evt) {
- var elm = evt.target;
- if (!_this.tf.sort) {
- return;
- }
- _this.stt.asyncSort(_array.Arr.indexByValue(triggers, elm.id, true));
- });
- trigger.setAttribute('_sortType', sortTypes[j]);
- }
- }
- }
- }
- }, {
- key: 'destroy',
-
- /**
- * Destroy sort
- */
- value: function destroy() {
- var tf = this.tf;
- tf.sort = false;
- this.sorted = false;
- this.stt.destroy();
-
- var ids = tf.getFiltersId();
- for (var idx = 0; idx < ids.length; idx++) {
- var header = tf.getHeaderElement(idx);
- var img = _dom.Dom.tag(header, 'img');
-
- if (img.length === 1) {
- header.removeChild(img[0]);
- }
- }
- }
- }]);
-
- return AdapterSortableTable;
- })();
-
- module.exports = AdapterSortableTable;
-
- //Converters
- function usNumberConverter(s) {
- return _helpers.Helpers.removeNbFormat(s, 'us');
- }
- function euNumberConverter(s) {
- return _helpers.Helpers.removeNbFormat(s, 'eu');
- }
- function dateConverter(s, format) {
- return _date.DateHelper.format(s, format);
- }
- function dmyDateConverter(s) {
- return dateConverter(s, 'DMY');
- }
- function mdyDateConverter(s) {
- return dateConverter(s, 'MDY');
- }
- function ymdDateConverter(s) {
- return dateConverter(s, 'YMD');
- }
- function ddmmmyyyyDateConverter(s) {
- return dateConverter(s, 'DDMMMYYYY');
- }
-
- function ipAddress(value) {
- var vals = value.split('.');
- for (var x in vals) {
- var val = vals[x];
- while (3 > val.length) {
- val = '0' + val;
- }
- vals[x] = val;
- }
- return vals.join('.');
- }
-
- function sortIP(a, b) {
- var aa = ipAddress(a.value.toLowerCase());
- var bb = ipAddress(b.value.toLowerCase());
- if (aa == bb) {
- return 0;
- } else if (aa < bb) {
- return -1;
- } else {
- return 1;
- }
- }
-});
-//# sourceMappingURL=adapterSortabletable.js.map
\ No newline at end of file
diff --git a/dev/helpers.js b/dev/helpers.js
deleted file mode 100644
index f684b261..00000000
--- a/dev/helpers.js
+++ /dev/null
@@ -1,31 +0,0 @@
-define(['exports', './string'], function (exports, _string) {
- 'use strict';
-
- var Helpers = {
- isIE: function isIE() {
- return /msie|MSIE/.test(navigator.userAgent);
- },
-
- removeNbFormat: function removeNbFormat(data, format) {
- if (!data) {
- return;
- }
- if (!format) {
- format = 'us';
- }
- var n = data;
- if (_string.Str.lower(format) === 'us') {
- n = +n.replace(/[^\d\.-]/g, '');
- } else {
- n = +n.replace(/[^\d\,-]/g, '').replace(',', '.');
- }
- return n;
- }
- };
-
- exports.Helpers = Helpers;
-});
-/**
- * Misc helpers
- */
-//# sourceMappingURL=helpers.js.map
\ No newline at end of file
diff --git a/dev/modules/alternateRows.js b/dev/modules/alternateRows.js
deleted file mode 100644
index 2fb8958e..00000000
--- a/dev/modules/alternateRows.js
+++ /dev/null
@@ -1,122 +0,0 @@
-define(['exports', '../dom'], function (exports, _dom) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var AlternateRows = (function () {
-
- /**
- * Alternating rows color
- * @param {Object} tf TableFilter instance
- */
-
- function AlternateRows(tf) {
- _classCallCheck(this, AlternateRows);
-
- var f = tf.config();
- //defines css class for even rows
- this.evenCss = f.even_row_css_class || 'even';
- //defines css class for odd rows
- this.oddCss = f.odd_row_css_class || 'odd';
-
- this.tf = tf;
- }
-
- _createClass(AlternateRows, [{
- key: 'init',
-
- /**
- * Sets alternating rows color
- */
- value: function init() {
- if (!this.tf.hasGrid() && !this.tf.isFirstLoad) {
- return;
- }
- var rows = this.tf.tbl.rows;
- var noValidRowsIndex = this.tf.validRowsIndex === null;
- //1st index
- var beginIndex = noValidRowsIndex ? this.tf.refRow : 0;
- // nb indexes
- var indexLen = noValidRowsIndex ? this.tf.nbFilterableRows + beginIndex : this.tf.validRowsIndex.length;
- var idx = 0;
-
- //alternates bg color
- for (var j = beginIndex; j < indexLen; j++) {
- var rowIdx = noValidRowsIndex ? j : this.tf.validRowsIndex[j];
- this.setRowBg(rowIdx, idx);
- idx++;
- }
- }
- }, {
- key: 'setRowBg',
-
- /**
- * Sets row background color
- * @param {Number} rowIdx Row index
- * @param {Number} idx Valid rows collection index needed to calculate bg
- * color
- */
- value: function setRowBg(rowIdx, idx) {
- if (!this.tf.alternateBgs || isNaN(rowIdx)) {
- return;
- }
- var rows = this.tf.tbl.rows;
- var i = !idx ? rowIdx : idx;
- this.removeRowBg(rowIdx);
- _dom.Dom.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss);
- }
- }, {
- key: 'removeRowBg',
-
- /**
- * Removes row background color
- * @param {Number} idx Row index
- */
- value: function removeRowBg(idx) {
- if (isNaN(idx)) {
- return;
- }
- var rows = this.tf.tbl.rows;
- _dom.Dom.removeClass(rows[idx], this.oddCss);
- _dom.Dom.removeClass(rows[idx], this.evenCss);
- }
- }, {
- key: 'remove',
-
- /**
- * Removes all row background color
- */
- value: function remove() {
- if (!this.tf.hasGrid()) {
- return;
- }
- var row = this.tf.tbl.rows;
- for (var i = this.tf.refRow; i < this.tf.nbRows; i++) {
- this.removeRowBg(i);
- }
- this.tf.isStartBgAlternate = true;
- }
- }, {
- key: 'enable',
- value: function enable() {
- this.tf.alternateBgs = true;
- }
- }, {
- key: 'disable',
- value: function disable() {
- this.tf.alternateBgs = false;
- }
- }]);
-
- return AlternateRows;
- })();
-
- exports.AlternateRows = AlternateRows;
-});
-//# sourceMappingURL=alternateRows.js.map
\ No newline at end of file
diff --git a/dev/modules/checkList.js b/dev/modules/checkList.js
deleted file mode 100644
index 6fc2f24c..00000000
--- a/dev/modules/checkList.js
+++ /dev/null
@@ -1,417 +0,0 @@
-define(['exports', '../dom', '../array', '../string', '../sort', '../event'], function (exports, _dom, _array, _string, _sort, _event) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var CheckList = (function () {
-
- /**
- * Checklist UI component
- * @param {Object} tf TableFilter instance
- */
-
- function CheckList(tf) {
- _classCallCheck(this, CheckList);
-
- // Configuration object
- var f = tf.config();
-
- this.checkListDiv = []; //checklist container div
- //defines css class for div containing checklist filter
- this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist';
- //defines css class for checklist filters
- this.checkListCssClass = f.checklist_css_class || 'flt_checklist';
- //defines css class for checklist item (li)
- this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item';
- //defines css class for selected checklist item (li)
- this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item';
- //Load on demand text
- this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data';
- //defines css class for checklist filters
- this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled';
- this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true;
- //checklist filter container div
- this.prfxCheckListDiv = 'chkdiv_';
-
- this.isCustom = null;
- this.opts = null;
- this.optsTxt = null;
-
- this.tf = tf;
- }
-
- _createClass(CheckList, [{
- key: 'onChange',
-
- // TODO: move event here
- value: function onChange(evt) {
- this.tf.Evt.onSlcChange(evt);
- }
- }, {
- key: 'optionClick',
- value: function optionClick(evt) {
- this.setCheckListValues(evt.target);
- this.onChange(evt);
- }
- }, {
- key: 'build',
-
- /**
- * Build checklist UI asynchronously
- * @param {Number} colIndex Column index
- * @param {Boolean} isExternal Render in external container
- * @param {String} extFltId External container id
- */
- value: function build(colIndex, isExternal, extFltId) {
- var tf = this.tf;
- tf.EvtManager(tf.Evt.name.checklist, { slcIndex: colIndex, slcExternal: isExternal, slcId: extFltId });
- }
- }, {
- key: '_build',
-
- /**
- * Build checklist UI
- * @param {Number} colIndex Column index
- * @param {Boolean} isExternal Render in external container
- * @param {String} extFltId External container id
- */
- value: function _build(colIndex) {
- var _this = this;
-
- var isExternal = arguments[1] === undefined ? false : arguments[1];
- var extFltId = arguments[2] === undefined ? null : arguments[2];
-
- var tf = this.tf;
- colIndex = parseInt(colIndex, 10);
-
- this.opts = [];
- this.optsTxt = [];
-
- var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id;
- if (!_dom.Dom.id(divFltId) && !isExternal || !_dom.Dom.id(extFltId) && isExternal) {
- return;
- }
-
- var flt = !isExternal ? this.checkListDiv[colIndex] : _dom.Dom.id(extFltId);
- var ul = _dom.Dom.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]);
- ul.className = this.checkListCssClass;
- _event.Event.add(ul, 'change', function (evt) {
- _this.onChange(evt);
- });
-
- var rows = tf.tbl.rows;
- this.isCustom = tf.hasCustomSlcOptions && _array.Arr.has(tf.customSlcOptions.cols, colIndex);
-
- var activeFlt;
- if (tf.refreshFilters && tf.activeFilterId) {
- activeFlt = tf.activeFilterId.split('_')[0];
- activeFlt = activeFlt.split(tf.prfxFlt)[1];
- }
-
- var excludedOpts,
- filteredDataCol = [];
- if (tf.refreshFilters && tf.disableExcludedOptions) {
- excludedOpts = [];
- }
-
- for (var k = tf.refRow; k < tf.nbRows; k++) {
- // always visible rows don't need to appear on selects as always
- // valid
- if (tf.hasVisibleRows && _array.Arr.has(tf.visibleRows, k) && !tf.paging) {
- continue;
- }
-
- var cells = rows[k].cells;
- var ncells = cells.length;
-
- // checks if row has exact cell #
- if (ncells !== tf.nbCells || this.isCustom) {
- continue;
- }
-
- // this loop retrieves cell data
- for (var j = 0; j < ncells; j++) {
- if (colIndex === j && (!tf.refreshFilters || tf.refreshFilters && tf.disableExcludedOptions) || colIndex === j && tf.refreshFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && _array.Arr.has(tf.validRowsIndex, k)))) {
- var cell_data = tf.getCellData(j, cells[j]);
- //Vary Peter's patch
- var cell_string = _string.Str.matchCase(cell_data, tf.matchCase);
- // checks if celldata is already in array
- if (!_array.Arr.has(this.opts, cell_string, tf.matchCase)) {
- this.opts.push(cell_data);
- }
- var filteredCol = filteredDataCol[j];
- if (tf.refreshFilters && tf.disableExcludedOptions) {
- if (!filteredCol) {
- filteredDataCol[j] = tf.GetFilteredDataCol(j);
- }
- if (!_array.Arr.has(filteredCol, cell_string, tf.matchCase) && !_array.Arr.has(excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) {
- excludedOpts.push(cell_data);
- }
- }
- }
- }
- }
-
- //Retrieves custom values
- if (this.isCustom) {
- var customValues = tf.__getCustomValues(colIndex);
- this.opts = customValues[0];
- this.optsTxt = customValues[1];
- }
-
- if (tf.sortSlc && !this.isCustom) {
- if (!tf.matchCase) {
- this.opts.sort(_sort.Sort.ignoreCase);
- if (excludedOpts) {
- excludedOpts.sort(_sort.Sort.ignoreCase);
- }
- } else {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- }
- }
- //asc sort
- if (tf.sortNumAsc && _array.Arr.has(tf.sortNumAsc, colIndex)) {
- try {
- this.opts.sort(numSortAsc);
- if (excludedOpts) {
- excludedOpts.sort(numSortAsc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(numSortAsc);
- }
- } catch (e) {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- if (this.isCustom) {
- this.optsTxt.sort();
- }
- } //in case there are alphanumeric values
- }
- //desc sort
- if (tf.sortNumDesc && _array.Arr.has(tf.sortNumDesc, colIndex)) {
- try {
- this.opts.sort(numSortDesc);
- if (excludedOpts) {
- excludedOpts.sort(numSortDesc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(numSortDesc);
- }
- } catch (e) {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- if (this.isCustom) {
- this.optsTxt.sort();
- }
- } //in case there are alphanumeric values
- }
-
- this.addChecks(colIndex, ul, tf.separator);
-
- if (tf.fillSlcOnDemand) {
- flt.innerHTML = '';
- }
- flt.appendChild(ul);
- flt.setAttribute('filled', '1');
- }
- }, {
- key: 'addChecks',
-
- /**
- * Add checklist options
- * @param {Number} colIndex Column index
- * @param {Object} ul Ul element
- * @param {String} separator Data separator
- */
- value: function addChecks(colIndex, ul, separator) {
- var _this2 = this;
-
- var tf = this.tf;
- var chkCt = this.addTChecks(colIndex, ul);
- var flts_values = [],
- fltArr = []; //remember grid values
- var store = tf.Cpt.store;
- var tmpVal = store ? store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null;
- if (tmpVal && _string.Str.trim(tmpVal).length > 0) {
- if (tf.hasCustomSlcOptions && _array.Arr.has(tf.customSlcOptions.cols, colIndex)) {
- fltArr.push(tmpVal);
- } else {
- fltArr = tmpVal.split(' ' + tf.orOperator + ' ');
- }
- }
-
- for (var y = 0; y < this.opts.length; y++) {
- var val = this.opts[y]; //item value
- var lbl = this.isCustom ? this.optsTxt[y] : val; //item text
- var li = _dom.Dom.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl);
- li.className = this.checkListItemCssClass;
- if (tf.refreshFilters && tf.disableExcludedOptions && _array.Arr.has(excludedOpts, _string.Str.matchCase(val, tf.matchCase), tf.matchCase)) {
- _dom.Dom.addClass(li, this.checkListItemDisabledCssClass);
- li.check.disabled = true;
- li.disabled = true;
- } else {
- _event.Event.add(li.check, 'click', function (evt) {
- _this2.optionClick(evt);
- });
- }
- ul.appendChild(li);
-
- if (val === '') {
- //item is hidden
- li.style.display = 'none';
- }
-
- /*** remember grid values ***/
- if (tf.rememberGridValues) {
- if (tf.hasCustomSlcOptions && _array.Arr.has(tf.customSlcOptions.cols, colIndex) && fltArr.toString().indexOf(val) != -1 || _array.Arr.has(fltArr, _string.Str.matchCase(val, tf.matchCase), tf.matchCase)) {
- li.check.checked = true;
- this.setCheckListValues(li.check);
- }
- }
- }
- }
- }, {
- key: 'addTChecks',
-
- /**
- * Add checklist header option
- * @param {Number} colIndex Column index
- * @param {Object} ul Ul element
- */
- value: function addTChecks(colIndex, ul) {
- var _this3 = this;
-
- var tf = this.tf;
- var chkCt = 1;
- var li0 = _dom.Dom.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText);
- li0.className = this.checkListItemCssClass;
- ul.appendChild(li0);
-
- _event.Event.add(li0.check, 'click', function (evt) {
- _this3.optionClick(evt);
- });
-
- if (!this.enableCheckListResetFilter) {
- li0.style.display = 'none';
- }
-
- if (tf.enableEmptyOption) {
- var li1 = _dom.Dom.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText);
- li1.className = this.checkListItemCssClass;
- ul.appendChild(li1);
- _event.Event.add(li1.check, 'click', function (evt) {
- _this3.optionClick(evt);
- });
- chkCt++;
- }
-
- if (tf.enableNonEmptyOption) {
- var li2 = _dom.Dom.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText);
- li2.className = this.checkListItemCssClass;
- ul.appendChild(li2);
- _event.Event.add(li2.check, 'click', function (evt) {
- _this3.optionClick(evt);
- });
- chkCt++;
- }
- return chkCt;
- }
- }, {
- key: 'setCheckListValues',
-
- /**
- * Store checked options in DOM element attribute
- * @param {Object} o checklist option DOM element
- */
- value: function setCheckListValues(o) {
- if (!o) {
- return;
- }
- var tf = this.tf;
- var chkValue = o.value; //checked item value
- var chkIndex = parseInt(o.id.split('_')[2], 10);
- var filterTag = 'ul',
- itemTag = 'li';
- var n = o;
-
- //ul tag search
- while (_string.Str.lower(n.nodeName) !== filterTag) {
- n = n.parentNode;
- }
-
- var li = n.childNodes[chkIndex];
- var colIndex = n.getAttribute('colIndex');
- var fltValue = n.getAttribute('value'); //filter value (ul tag)
- var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag)
-
- if (o.checked) {
- //show all item
- if (chkValue === '') {
- if (fltIndexes && fltIndexes !== '') {
- //items indexes
- var indSplit = fltIndexes.split(tf.separator);
- //checked items loop
- for (var u = 0; u < indSplit.length; u++) {
- //checked item
- var cChk = _dom.Dom.id(tf.fltIds[colIndex] + '_' + indSplit[u]);
- if (cChk) {
- cChk.checked = false;
- _dom.Dom.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass);
- }
- }
- }
- n.setAttribute('value', '');
- n.setAttribute('indexes', '');
- } else {
- fltValue = fltValue ? fltValue : '';
- chkValue = _string.Str.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator);
- chkIndex = fltIndexes + chkIndex + tf.separator;
- n.setAttribute('value', chkValue);
- n.setAttribute('indexes', chkIndex);
- //1st option unchecked
- if (_dom.Dom.id(tf.fltIds[colIndex] + '_0')) {
- _dom.Dom.id(tf.fltIds[colIndex] + '_0').checked = false;
- }
- }
-
- if (_string.Str.lower(li.nodeName) === itemTag) {
- _dom.Dom.removeClass(n.childNodes[0], this.checkListSlcItemCssClass);
- _dom.Dom.addClass(li, this.checkListSlcItemCssClass);
- }
- } else {
- //removes values and indexes
- if (chkValue !== '') {
- var replaceValue = new RegExp(_string.Str.rgxEsc(chkValue + ' ' + tf.orOperator));
- fltValue = fltValue.replace(replaceValue, '');
- n.setAttribute('value', _string.Str.trim(fltValue));
-
- var replaceIndex = new RegExp(_string.Str.rgxEsc(chkIndex + tf.separator));
- fltIndexes = fltIndexes.replace(replaceIndex, '');
- n.setAttribute('indexes', fltIndexes);
- }
- if (_string.Str.lower(li.nodeName) === itemTag) {
- _dom.Dom.removeClass(li, this.checkListSlcItemCssClass);
- }
- }
- }
- }]);
-
- return CheckList;
- })();
-
- exports.CheckList = CheckList;
-});
-//# sourceMappingURL=checkList.js.map
\ No newline at end of file
diff --git a/dev/modules/clearButton.js b/dev/modules/clearButton.js
deleted file mode 100644
index 0d1e9512..00000000
--- a/dev/modules/clearButton.js
+++ /dev/null
@@ -1,115 +0,0 @@
-define(['exports', '../dom', '../event'], function (exports, _dom, _event) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var ClearButton = (function () {
-
- /**
- * Clear button component
- * @param {Object} tf TableFilter instance
- */
-
- function ClearButton(tf) {
- _classCallCheck(this, ClearButton);
-
- // Configuration object
- var f = tf.config();
-
- //id of container element
- this.btnResetTgtId = f.btn_reset_target_id || null;
- //reset button element
- this.btnResetEl = null;
- //defines reset text
- this.btnResetText = f.btn_reset_text || 'Reset';
- //defines reset button tooltip
- this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters';
- //defines reset button innerHtml
- this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ' ');
- //span containing reset button
- this.prfxResetSpan = 'resetspan_';
-
- this.tf = tf;
- }
-
- _createClass(ClearButton, [{
- key: 'onClick',
- value: function onClick() {
- this.tf.clearFilters();
- }
- }, {
- key: 'init',
-
- /**
- * Build DOM elements
- */
- value: function init() {
- var _this = this;
-
- var tf = this.tf;
-
- if (!tf.hasGrid() && !tf.isFirstLoad && tf.btnResetEl) {
- return;
- }
-
- var resetspan = _dom.Dom.create('span', ['id', this.prfxResetSpan + tf.id]);
-
- // reset button is added to defined element
- if (!this.btnResetTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.btnResetTgtId ? tf.rDiv : _dom.Dom.id(this.btnResetTgtId);
- targetEl.appendChild(resetspan);
-
- if (!this.btnResetHtml) {
- var fltreset = _dom.Dom.create('a', ['href', 'javascript:void(0);']);
- fltreset.className = tf.btnResetCssClass;
- fltreset.appendChild(_dom.Dom.text(this.btnResetText));
- resetspan.appendChild(fltreset);
- // fltreset.onclick = this.Evt._Clear;
- _event.Event.add(fltreset, 'click', function () {
- _this.onClick();
- });
- } else {
- resetspan.innerHTML = this.btnResetHtml;
- var resetEl = resetspan.firstChild;
- // resetEl.onclick = this.Evt._Clear;
- _event.Event.add(resetEl, 'click', function () {
- _this.onClick();
- });
- }
- this.btnResetEl = resetspan.firstChild;
- }
- }, {
- key: 'destroy',
-
- /**
- * Remove clear button UI
- */
- value: function destroy() {
- var tf = this.tf;
-
- if (!tf.hasGrid() || !this.btnResetEl) {
- return;
- }
-
- var resetspan = _dom.Dom.id(tf.prfxResetSpan + tf.id);
- if (resetspan) {
- resetspan.parentNode.removeChild(resetspan);
- }
- this.btnResetEl = null;
- }
- }]);
-
- return ClearButton;
- })();
-
- exports.ClearButton = ClearButton;
-});
-//# sourceMappingURL=clearButton.js.map
\ No newline at end of file
diff --git a/dev/modules/colOps.js b/dev/modules/colOps.js
deleted file mode 100644
index 5446d570..00000000
--- a/dev/modules/colOps.js
+++ /dev/null
@@ -1,310 +0,0 @@
-define(['exports', '../dom', '../string', '../types'], function (exports, _dom, _string, _types) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var ColOps = (function () {
-
- /**
- * Column calculations
- * @param {Object} tf TableFilter instance
- */
-
- function ColOps(tf) {
- _classCallCheck(this, ColOps);
-
- var f = tf.config();
- this.colOperation = f.col_operation;
-
- //calls function before col operation
- this.onBeforeOperation = _types.Types.isFn(f.on_before_operation) ? f.on_before_operation : null;
- //calls function after col operation
- this.onAfterOperation = _types.Types.isFn(f.on_after_operation) ? f.on_after_operation : null;
-
- this.tf = tf;
- }
-
- _createClass(ColOps, [{
- key: 'calc',
-
- /**
- * Calculates columns' values
- * Configuration options are stored in 'colOperation' property
- * - 'id' contains ids of elements showing result (array)
- * - 'col' contains the columns' indexes (array)
- * - 'operation' contains operation type (array, values: 'sum', 'mean',
- * 'min', 'max', 'median', 'q1', 'q3')
- * - 'write_method' array defines which method to use for displaying the
- * result (innerHTML, setValue, createTextNode) - default: 'innerHTML'
- * - 'tot_row_index' defines in which row results are displayed
- * (integers array)
- *
- * - changes made by Nuovella:
- * (1) optimized the routine (now it will only process each column once),
- * (2) added calculations for the median, lower and upper quartile.
- */
- value: function calc() {
- if (!this.tf.isFirstLoad && !this.tf.hasGrid()) {
- return;
- }
-
- if (this.onBeforeOperation) {
- this.onBeforeOperation.call(null, this.tf);
- }
-
- var colOperation = this.colOperation,
- labelId = colOperation.id,
- colIndex = colOperation.col,
- operation = colOperation.operation,
- outputType = colOperation.write_method,
- totRowIndex = colOperation.tot_row_index,
- excludeRow = colOperation.exclude_row,
- decimalPrecision = colOperation.decimal_precision !== undefined ? colOperation.decimal_precision : 2;
-
- //nuovella: determine unique list of columns to operate on
- var ucolIndex = [],
- ucolMax = 0;
- ucolIndex[ucolMax] = colIndex[0];
-
- for (var ii = 1; ii < colIndex.length; ii++) {
- var saved = 0;
- //see if colIndex[ii] is already in the list of unique indexes
- for (var jj = 0; jj <= ucolMax; jj++) {
- if (ucolIndex[jj] === colIndex[ii]) {
- saved = 1;
- }
- }
- //if not saved then, save the index;
- if (saved === 0) {
- ucolMax++;
- ucolIndex[ucolMax] = colIndex[ii];
- }
- }
-
- if (_string.Str.lower(typeof labelId) == 'object' && _string.Str.lower(typeof colIndex) == 'object' && _string.Str.lower(typeof operation) == 'object') {
- var row = this.tf.tbl.rows,
- colvalues = [];
-
- for (var ucol = 0; ucol <= ucolMax; ucol++) {
- //this retrieves col values
- //use ucolIndex because we only want to pass through this loop
- //once for each column get the values in this unique column
- colvalues.push(this.tf.getColValues(ucolIndex[ucol], true, excludeRow));
-
- //next: calculate all operations for this column
- var result,
- nbvalues = 0,
- temp,
- meanValue = 0,
- sumValue = 0,
- minValue = null,
- maxValue = null,
- q1Value = null,
- medValue = null,
- q3Value = null,
- meanFlag = 0,
- sumFlag = 0,
- minFlag = 0,
- maxFlag = 0,
- q1Flag = 0,
- medFlag = 0,
- q3Flag = 0,
- theList = [],
- opsThisCol = [],
- decThisCol = [],
- labThisCol = [],
- oTypeThisCol = [],
- mThisCol = -1;
-
- for (var k = 0; k < colIndex.length; k++) {
- if (colIndex[k] === ucolIndex[ucol]) {
- mThisCol++;
- opsThisCol[mThisCol] = _string.Str.lower(operation[k]);
- decThisCol[mThisCol] = decimalPrecision[k];
- labThisCol[mThisCol] = labelId[k];
- oTypeThisCol = outputType !== undefined && _string.Str.lower(typeof outputType) === 'object' ? outputType[k] : null;
-
- switch (opsThisCol[mThisCol]) {
- case 'mean':
- meanFlag = 1;
- break;
- case 'sum':
- sumFlag = 1;
- break;
- case 'min':
- minFlag = 1;
- break;
- case 'max':
- maxFlag = 1;
- break;
- case 'median':
- medFlag = 1;
- break;
- case 'q1':
- q1Flag = 1;
- break;
- case 'q3':
- q3Flag = 1;
- break;
- }
- }
- }
-
- for (var j = 0; j < colvalues[ucol].length; j++) {
- //sort the list for calculation of median and quartiles
- if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) {
- if (j < colvalues[ucol].length - 1) {
- for (k = j + 1; k < colvalues[ucol].length; k++) {
- if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) {
- temp = colvalues[ucol][j];
- colvalues[ucol][j] = colvalues[ucol][k];
- colvalues[ucol][k] = temp;
- }
- }
- }
- }
- var cvalue = parseFloat(colvalues[ucol][j]);
- theList[j] = parseFloat(cvalue);
-
- if (!isNaN(cvalue)) {
- nbvalues++;
- if (sumFlag === 1 || meanFlag === 1) {
- sumValue += parseFloat(cvalue);
- }
- if (minFlag === 1) {
- if (minValue === null) {
- minValue = parseFloat(cvalue);
- } else {
- minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue;
- }
- }
- if (maxFlag === 1) {
- if (maxValue === null) {
- maxValue = parseFloat(cvalue);
- } else {
- maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue;
- }
- }
- }
- } //for j
- if (meanFlag === 1) {
- meanValue = sumValue / nbvalues;
- }
- if (medFlag === 1) {
- var aux = 0;
- if (nbvalues % 2 === 1) {
- aux = Math.floor(nbvalues / 2);
- medValue = theList[aux];
- } else {
- medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2;
- }
- }
- var posa;
- if (q1Flag === 1) {
- posa = 0;
- posa = Math.floor(nbvalues / 4);
- if (4 * posa == nbvalues) {
- q1Value = (theList[posa - 1] + theList[posa]) / 2;
- } else {
- q1Value = theList[posa];
- }
- }
- if (q3Flag === 1) {
- posa = 0;
- var posb = 0;
- posa = Math.floor(nbvalues / 4);
- if (4 * posa === nbvalues) {
- posb = 3 * posa;
- q3Value = (theList[posb] + theList[posb - 1]) / 2;
- } else {
- q3Value = theList[nbvalues - posa - 1];
- }
- }
-
- for (var i = 0; i <= mThisCol; i++) {
- switch (opsThisCol[i]) {
- case 'mean':
- result = meanValue;
- break;
- case 'sum':
- result = sumValue;
- break;
- case 'min':
- result = minValue;
- break;
- case 'max':
- result = maxValue;
- break;
- case 'median':
- result = medValue;
- break;
- case 'q1':
- result = q1Value;
- break;
- case 'q3':
- result = q3Value;
- break;
- }
-
- var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2;
-
- //if outputType is defined
- if (oTypeThisCol && result) {
- result = result.toFixed(precision);
-
- if (_dom.Dom.id(labThisCol[i])) {
- switch (_string.Str.lower(oTypeThisCol)) {
- case 'innerhtml':
- if (isNaN(result) || !isFinite(result) || nbvalues === 0) {
- _dom.Dom.id(labThisCol[i]).innerHTML = '.';
- } else {
- _dom.Dom.id(labThisCol[i]).innerHTML = result;
- }
- break;
- case 'setvalue':
- _dom.Dom.id(labThisCol[i]).value = result;
- break;
- case 'createtextnode':
- var oldnode = _dom.Dom.id(labThisCol[i]).firstChild;
- var txtnode = _dom.Dom.text(result);
- _dom.Dom.id(labThisCol[i]).replaceChild(txtnode, oldnode);
- break;
- } //switch
- }
- } else {
- try {
- if (isNaN(result) || !isFinite(result) || nbvalues === 0) {
- _dom.Dom.id(labThisCol[i]).innerHTML = '.';
- } else {
- _dom.Dom.id(labThisCol[i]).innerHTML = result.toFixed(precision);
- }
- } catch (e) {} //catch
- } //else
- } //for i
-
- // row(s) with result are always visible
- var totRow = totRowIndex && totRowIndex[ucol] ? row[totRowIndex[ucol]] : null;
- if (totRow) {
- totRow.style.display = '';
- }
- } //for ucol
- } //if typeof
-
- if (this.onAfterOperation) {
- this.onAfterOperation.call(null, this.tf);
- }
- }
- }]);
-
- return ColOps;
- })();
-
- exports.ColOps = ColOps;
-});
-//# sourceMappingURL=colOps.js.map
\ No newline at end of file
diff --git a/dev/modules/dropdown.js b/dev/modules/dropdown.js
deleted file mode 100644
index 6e289d6c..00000000
--- a/dev/modules/dropdown.js
+++ /dev/null
@@ -1,328 +0,0 @@
-define(['exports', '../dom', '../array', '../string', '../sort'], function (exports, _dom, _array, _string, _sort) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var Dropdown = (function () {
-
- /**
- * Dropdown UI component
- * @param {Object} tf TableFilter instance
- */
-
- function Dropdown(tf) {
- _classCallCheck(this, Dropdown);
-
- // Configuration object
- var f = tf.config();
-
- this.enableSlcResetFilter = f.enable_slc_reset_filter ? false : true;
- //defines empty option text
- this.nonEmptyText = f.non_empty_text || '(Non empty)';
- //sets select filling method: 'innerHTML' or 'createElement'
- this.slcFillingMethod = f.slc_filling_method || 'createElement';
- //IE only, tooltip text appearing on select before it is populated
- this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate';
- //tooltip text appearing on multiple select
- this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections';
-
- this.isCustom = null;
- this.opts = null;
- this.optsTxt = null;
- this.slcInnerHtml = null;
-
- this.tf = tf;
- }
-
- _createClass(Dropdown, [{
- key: 'build',
-
- /**
- * Build drop-down filter UI asynchronously
- * @param {Number} colIndex Column index
- * @param {Boolean} isRefreshed Enable linked refresh behaviour
- * @param {Boolean} isExternal Render in external container
- * @param {String} extSlcId External container id
- */
- value: function build(colIndex, isRefreshed, isExternal, extSlcId) {
- var tf = this.tf;
- tf.EvtManager(tf.Evt.name.dropdown, {
- slcIndex: colIndex,
- slcRefreshed: isRefreshed,
- slcExternal: isExternal,
- slcId: extSlcId
- });
- }
- }, {
- key: '_build',
-
- /**
- * Build drop-down filter UI
- * @param {Number} colIndex Column index
- * @param {Boolean} isRefreshed Enable linked refresh behaviour
- * @param {Boolean} isExternal Render in external container
- * @param {String} extSlcId External container id
- */
- value: function _build(colIndex) {
- var isRefreshed = arguments[1] === undefined ? false : arguments[1];
- var isExternal = arguments[2] === undefined ? false : arguments[2];
- var extSlcId = arguments[3] === undefined ? null : arguments[3];
-
- var tf = this.tf;
- colIndex = parseInt(colIndex, 10);
-
- this.opts = [];
- this.optsTxt = [];
- this.slcInnerHtml = '';
-
- var slcId = tf.fltIds[colIndex];
- if (!_dom.Dom.id(slcId) && !isExternal || !_dom.Dom.id(extSlcId) && isExternal) {
- return;
- }
- var slc = !isExternal ? _dom.Dom.id(slcId) : _dom.Dom.id(extSlcId),
- rows = tf.tbl.rows,
- matchCase = tf.matchCase,
- fillMethod = _string.Str.lower(this.slcFillingMethod);
-
- //custom select test
- this.isCustom = tf.hasCustomSlcOptions && _array.Arr.has(tf.customSlcOptions.cols, colIndex);
-
- //custom selects text
- var activeFlt;
- if (isRefreshed && tf.activeFilterId) {
- activeFlt = tf.activeFilterId.split('_')[0];
- activeFlt = activeFlt.split(tf.prfxFlt)[1];
- }
-
- /*** remember grid values ***/
- var fltsValues = [],
- fltArr = [];
- if (tf.rememberGridValues) {
- fltsValues = tf.Cpt.store.getFilterValues(tf.fltsValuesCookie);
- if (fltsValues && !_string.Str.isEmpty(fltsValues.toString())) {
- if (this.isCustom) {
- fltArr.push(fltsValues[colIndex]);
- } else {
- fltArr = fltsValues[colIndex].split(' ' + tf.orOperator + ' ');
- }
- }
- }
-
- var excludedOpts = null,
- filteredDataCol = null;
- if (isRefreshed && tf.disableExcludedOptions) {
- excludedOpts = [];
- filteredDataCol = [];
- }
-
- for (var k = tf.refRow; k < tf.nbRows; k++) {
- // always visible rows don't need to appear on selects as always
- // valid
- if (tf.hasVisibleRows && _array.Arr.has(tf.visibleRows, k) && !tf.paging) {
- continue;
- }
-
- var cell = rows[k].cells,
- nchilds = cell.length;
-
- // checks if row has exact cell #
- if (nchilds !== tf.nbCells || this.isCustom) {
- continue;
- }
-
- // this loop retrieves cell data
- for (var j = 0; j < nchilds; j++) {
- if (colIndex === j && (!isRefreshed || isRefreshed && tf.disableExcludedOptions) || colIndex == j && isRefreshed && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && _array.Arr.has(tf.validRowsIndex, k)) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && _array.Arr.has(tf.validRowsIndex, k)))) {
- var cell_data = tf.getCellData(j, cell[j]),
-
- //Vary Peter's patch
- cell_string = _string.Str.matchCase(cell_data, matchCase);
-
- // checks if celldata is already in array
- if (!_array.Arr.has(this.opts, cell_string, matchCase)) {
- this.opts.push(cell_data);
- }
-
- if (isRefreshed && tf.disableExcludedOptions) {
- var filteredCol = filteredDataCol[j];
- if (!filteredCol) {
- filteredCol = this.GetFilteredDataCol(j);
- }
- if (!_array.Arr.has(filteredCol, cell_string, matchCase) && !_array.Arr.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) {
- excludedOpts.push(cell_data);
- }
- }
- } //if colIndex==j
- } //for j
- } //for k
-
- //Retrieves custom values
- if (this.isCustom) {
- var customValues = tf.__getCustomValues(colIndex);
- this.opts = customValues[0];
- this.optsTxt = customValues[1];
- }
-
- if (tf.sortSlc && !this.isCustom) {
- if (!matchCase) {
- this.opts.sort(_sort.Sort.ignoreCase);
- if (excludedOpts) {
- excludedOpts.sort(_sort.Sort.ignoreCase);
- }
- } else {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- }
- }
-
- //asc sort
- if (tf.sortNumAsc && _array.Arr.has(tf.sortNumAsc, colIndex)) {
- try {
- this.opts.sort(numSortAsc);
- if (excludedOpts) {
- excludedOpts.sort(numSortAsc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(numSortAsc);
- }
- } catch (e) {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- if (this.isCustom) {
- this.optsTxt.sort();
- }
- } //in case there are alphanumeric values
- }
- //desc sort
- if (tf.sortNumDesc && _array.Arr.has(tf.sortNumDesc, colIndex)) {
- try {
- this.opts.sort(numSortDesc);
- if (excludedOpts) {
- excludedOpts.sort(numSortDesc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(numSortDesc);
- }
- } catch (e) {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- if (this.isCustom) {
- this.optsTxt.sort();
- }
- } //in case there are alphanumeric values
- }
-
- //populates drop-down
- this.addOptions(colIndex, slc, isRefreshed, excludedOpts, fltsValues, fltArr);
- }
- }, {
- key: 'addOptions',
-
- /**
- * Add drop-down options
- * @param {Number} colIndex Column index
- * @param {Object} slc Select Dom element
- * @param {Boolean} isRefreshed Enable linked refresh behaviour
- * @param {Array} excludedOpts Array of excluded options
- * @param {Array} fltsValues Collection of persisted filter values
- * @param {Array} fltArr Collection of persisted filter values
- */
- value: function addOptions(colIndex, slc, isRefreshed, excludedOpts, fltsValues, fltArr) {
- var tf = this.tf,
- fillMethod = _string.Str.lower(this.slcFillingMethod),
- slcValue = slc.value;
-
- slc.innerHTML = '';
- slc = this.addFirstOption(slc);
-
- for (var y = 0; y < this.opts.length; y++) {
- if (this.opts[y] === '') {
- continue;
- }
- var val = this.opts[y]; //option value
- var lbl = this.isCustom ? this.optsTxt[y] : val; //option text
- var isDisabled = false;
- if (isRefreshed && this.disableExcludedOptions && _array.Arr.has(excludedOpts, _string.Str.matchCase(val, tf.matchCase), tf.matchCase)) {
- isDisabled = true;
- }
-
- if (fillMethod === 'innerhtml') {
- var slcAttr = '';
- if (tf.fillSlcOnDemand && slcValue === this.opts[y]) {
- slcAttr = 'selected="selected"';
- }
- this.slcInnerHtml += '' + lbl + ' ';
- } else {
- var opt;
- //fill select on demand
- if (tf.fillSlcOnDemand && slcValue === this.opts[y] && tf['col' + colIndex] === tf.fltTypeSlc) {
- opt = _dom.Dom.createOpt(lbl, val, true);
- } else {
- if (tf['col' + colIndex] !== tf.fltTypeMulti) {
- opt = _dom.Dom.createOpt(lbl, val, fltsValues[colIndex] !== ' ' && val === fltsValues[colIndex] ? true : false);
- } else {
- opt = _dom.Dom.createOpt(lbl, val, _array.Arr.has(fltArr, _string.Str.matchCase(this.opts[y], tf.matchCase), tf.matchCase) || fltArr.toString().indexOf(val) !== -1 ? true : false);
- }
- }
- if (isDisabled) {
- opt.disabled = true;
- }
- slc.appendChild(opt);
- }
- } // for y
-
- if (fillMethod === 'innerhtml') {
- slc.innerHTML += this.slcInnerHtml;
- }
- slc.setAttribute('filled', '1');
- }
- }, {
- key: 'addFirstOption',
-
- /**
- * Add drop-down header option
- * @param {Object} slc Select DOM element
- */
- value: function addFirstOption(slc) {
- var tf = this.tf,
- fillMethod = _string.Str.lower(this.slcFillingMethod);
-
- if (fillMethod === 'innerhtml') {
- this.slcInnerHtml += '' + tf.displayAllText + ' ';
- } else {
- var opt0 = _dom.Dom.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, '');
- if (!this.enableSlcResetFilter) {
- opt0.style.display = 'none';
- }
- slc.appendChild(opt0);
- if (tf.enableEmptyOption) {
- var opt1 = _dom.Dom.createOpt(tf.emptyText, tf.emOperator);
- slc.appendChild(opt1);
- }
- if (tf.enableNonEmptyOption) {
- var opt2 = _dom.Dom.createOpt(tf.nonEmptyText, tf.nmOperator);
- slc.appendChild(opt2);
- }
- }
- return slc;
- }
- }]);
-
- return Dropdown;
- })();
-
- exports.Dropdown = Dropdown;
-});
-//# sourceMappingURL=dropdown.js.map
\ No newline at end of file
diff --git a/dev/modules/gridLayout.js b/dev/modules/gridLayout.js
deleted file mode 100644
index 2a36b818..00000000
--- a/dev/modules/gridLayout.js
+++ /dev/null
@@ -1,365 +0,0 @@
-define(['exports', '../dom', '../types', '../helpers', '../event'], function (exports, _dom, _types, _helpers, _event) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var GridLayout = (function () {
-
- /**
- * Grid layout, table with fixed headers
- * @param {Object} tf TableFilter instance
- */
-
- function GridLayout(tf) {
- _classCallCheck(this, GridLayout);
-
- var f = tf.config();
-
- //defines grid width
- this.gridWidth = f.grid_width || null;
- //defines grid height
- this.gridHeight = f.grid_height || null;
- //defines css class for main container
- this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont';
- //defines css class for div containing table
- this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont';
- //defines css class for div containing headers' table
- this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont';
- //defines css class for div containing rows counter, paging etc.
- this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf';
- //defines which row contains column headers
- this.gridHeadRowIndex = f.grid_headers_row_index || 0;
- //array of headers row indexes to be placed in header table
- this.gridHeadRows = f.grid_headers_rows || [0];
- //generate filters in table headers
- this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true;
- //default col width
- this.gridDefaultColWidth = f.grid_default_col_width || '100px';
- //enables/disables columns resizer
- this.gridEnableColResizer = f.grid_enable_cols_resizer !== undefined ? f.grid_enable_cols_resizer : false;
- //defines col resizer script path
- this.gridColResizerPath = f.grid_cont_col_resizer_path || this.basePath + 'TFExt_ColsResizer/TFExt_ColsResizer.js';
-
- this.gridColElms = [];
-
- //div containing grid elements if grid_layout true
- this.prfxMainTblCont = 'gridCont_';
- //div containing table if grid_layout true
- this.prfxTblCont = 'tblCont_';
- //div containing headers table if grid_layout true
- this.prfxHeadTblCont = 'tblHeadCont_';
- //headers' table if grid_layout true
- this.prfxHeadTbl = 'tblHead_';
- //id of td containing the filter if grid_layout true
- this.prfxGridFltTd = '_td_';
- //id of th containing column header if grid_layout true
- this.prfxGridTh = 'tblHeadTh_';
-
- this.tf = tf;
- }
-
- _createClass(GridLayout, [{
- key: 'init',
-
- /**
- * Generates a grid with fixed headers
- */
- value: function init() {
- var _this = this;
-
- var tf = this.tf;
- var f = tf.config();
- var tbl = tf.tbl;
-
- if (!tf.gridLayout) {
- return;
- }
-
- tf.isExternalFlt = true;
-
- // default width of 100px if column widths not set
- if (!tf.hasColWidth) {
- tf.colWidth = [];
- for (var k = 0; k < tf.nbCells; k++) {
- var colW,
- cell = tbl.rows[this.gridHeadRowIndex].cells[k];
- if (cell.width !== '') {
- colW = cell.width;
- } else if (cell.style.width !== '') {
- colW = parseInt(cell.style.width, 10);
- } else {
- colW = this.gridDefaultColWidth;
- }
- tf.colWidth[k] = colW;
- }
- tf.hasColWidth = true;
- }
- tf.setColWidths(this.gridHeadRowIndex);
-
- var tblW; //initial table width
- if (tbl.width !== '') {
- tblW = tbl.width;
- } else if (tbl.style.width !== '') {
- tblW = parseInt(tbl.style.width, 10);
- } else {
- tblW = tbl.clientWidth;
- }
-
- //Main container: it will contain all the elements
- this.tblMainCont = _dom.Dom.create('div', ['id', this.prfxMainTblCont + tf.id]);
- this.tblMainCont.className = this.gridMainContCssClass;
- if (this.gridWidth) {
- this.tblMainCont.style.width = this.gridWidth;
- }
- tbl.parentNode.insertBefore(this.tblMainCont, tbl);
-
- //Table container: div wrapping content table
- this.tblCont = _dom.Dom.create('div', ['id', this.prfxTblCont + tf.id]);
- this.tblCont.className = this.gridContCssClass;
- if (this.gridWidth) {
- this.tblCont.style.width = this.gridWidth;
- }
- if (this.gridHeight) {
- this.tblCont.style.height = this.gridHeight;
- }
- tbl.parentNode.insertBefore(this.tblCont, tbl);
- var t = tbl.parentNode.removeChild(tbl);
- this.tblCont.appendChild(t);
-
- //In case table width is expressed in %
- if (tbl.style.width === '') {
- tbl.style.width = (tf._containsStr('%', tblW) ? tbl.clientWidth : tblW) + 'px';
- }
-
- var d = this.tblCont.parentNode.removeChild(this.tblCont);
- this.tblMainCont.appendChild(d);
-
- //Headers table container: div wrapping headers table
- this.headTblCont = _dom.Dom.create('div', ['id', this.prfxHeadTblCont + tf.id]);
- this.headTblCont.className = this.gridHeadContCssClass;
- if (this.gridWidth) {
- this.headTblCont.style.width = this.gridWidth;
- }
-
- //Headers table
- this.headTbl = _dom.Dom.create('table', ['id', this.prfxHeadTbl + tf.id]);
- var tH = _dom.Dom.create('tHead'); //IE<7 needs it
-
- //1st row should be headers row, ids are added if not set
- //Those ids are used by the sort feature
- var hRow = tbl.rows[this.gridHeadRowIndex];
- var sortTriggers = [];
- for (var n = 0; n < tf.nbCells; n++) {
- var c = hRow.cells[n];
- var thId = c.getAttribute('id');
- if (!thId || thId === '') {
- thId = this.prfxGridTh + n + '_' + tf.id;
- c.setAttribute('id', thId);
- }
- sortTriggers.push(thId);
- }
-
- //Filters row is created
- var filtersRow = _dom.Dom.create('tr');
- if (this.gridEnableFilters && tf.fltGrid) {
- tf.externalFltTgtIds = [];
- for (var j = 0; j < tf.nbCells; j++) {
- var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id;
- var cl = _dom.Dom.create(tf.fltCellTag, ['id', fltTdId]);
- filtersRow.appendChild(cl);
- tf.externalFltTgtIds[j] = fltTdId;
- }
- }
- //Headers row are moved from content table to headers table
- for (var i = 0; i < this.gridHeadRows.length; i++) {
- var headRow = tbl.rows[this.gridHeadRows[0]];
- tH.appendChild(headRow);
- }
- this.headTbl.appendChild(tH);
- if (tf.filtersRowIndex === 0) {
- tH.insertBefore(filtersRow, hRow);
- } else {
- tH.appendChild(filtersRow);
- }
-
- this.headTblCont.appendChild(this.headTbl);
- this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont);
-
- //THead needs to be removed in content table for sort feature
- var thead = _dom.Dom.tag(tbl, 'thead');
- if (thead.length > 0) {
- tbl.removeChild(thead[0]);
- }
-
- //Headers table style
- this.headTbl.style.tableLayout = 'fixed';
- tbl.style.tableLayout = 'fixed';
- this.headTbl.cellPadding = tbl.cellPadding;
- this.headTbl.cellSpacing = tbl.cellSpacing;
- // this.headTbl.style.width = tbl.style.width;
-
- //content table without headers needs col widths to be reset
- tf.setColWidths();
-
- //Headers container width
- this.headTblCont.style.width = this.tblCont.clientWidth + 'px';
-
- tbl.style.width = '';
- //
- this.headTbl.style.width = tbl.clientWidth + 'px';
- //
-
- //scroll synchronisation
- _event.Event.add(this.tblCont, 'scroll', function (evt) {
- var elm = _event.Event.target(evt);
- var scrollLeft = elm.scrollLeft;
- _this.headTblCont.scrollLeft = scrollLeft;
- //New pointerX calc taking into account scrollLeft
- // if(!o.isPointerXOverwritten){
- // try{
- // o.Evt.pointerX = function(evt){
- // var e = evt || global.event;
- // var bdScrollLeft = tf_StandardBody().scrollLeft +
- // scrollLeft;
- // return (e.pageX + scrollLeft) ||
- // (e.clientX + bdScrollLeft);
- // };
- // o.isPointerXOverwritten = true;
- // } catch(err) {
- // o.isPointerXOverwritten = false;
- // }
- // }
- });
-
- //Sort is enabled if not specified in config object
- if (f.sort !== false) {
- tf.sort = true;
- tf.sortConfig.asyncSort = true;
- tf.sortConfig.triggerIds = sortTriggers;
- }
-
- if (this.gridEnableColResizer) {
- if (!tf.hasExtensions) {
- tf.extensions = {
- name: ['ColumnsResizer_' + tf.id],
- src: [this.gridColResizerPath],
- description: ['Columns Resizing'],
- initialize: [function (o) {
- o.SetColsResizer('ColumnsResizer_' + o.id);
- }]
- };
- tf.hasExtensions = true;
- } else {
- if (!tf._containsStr('colsresizer', Str.lower(tf.extensions.src.toString()))) {
- tf.extensions.name.push('ColumnsResizer_' + tf.id);
- tf.extensions.src.push(tf.gridColResizerPath);
- tf.extensions.description.push('Columns Resizing');
- tf.extensions.initialize.push(function (o) {
- o.SetColsResizer('ColumnsResizer_' + o.id);
- });
- }
- }
- }
-
- //Default columns resizer properties for grid layout
- f.col_resizer_cols_headers_table = this.headTbl.getAttribute('id');
- f.col_resizer_cols_headers_index = this.gridHeadRowIndex;
- f.col_resizer_width_adjustment = 0;
- f.col_enable_text_ellipsis = false;
-
- //Cols generation for all browsers excepted IE<=7
- this.tblHasColTag = _dom.Dom.tag(tbl, 'col').length > 0 ? true : false;
-
- //Col elements are enough to keep column widths after sorting and
- //filtering
- var createColTags = function createColTags(o) {
- if (!o) {
- return;
- }
- for (var k = tf.nbCells - 1; k >= 0; k--) {
- var col = _dom.Dom.create('col', ['id', tf.id + '_col_' + k]);
- tbl.firstChild.parentNode.insertBefore(col, tbl.firstChild);
- col.style.width = tf.colWidth[k];
- o.gridColElms[k] = col;
- }
- o.tblHasColTag = true;
- };
- if (!this.tblHasColTag) {
- createColTags(this);
- } else {
- var cols = _dom.Dom.tag(tbl, 'col');
- for (var ii = 0; ii < tf.nbCells; ii++) {
- cols[ii].setAttribute('id', tf.id + '_col_' + ii);
- cols[ii].style.width = tf.colWidth[ii];
- o.gridColElms.push(cols[ii]);
- }
- }
-
- var afterColResizedFn = _types.Types.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null;
- f.on_after_col_resized = function (o, colIndex) {
- if (!colIndex) {
- return;
- }
- var w = o.crWColsRow.cells[colIndex].style.width;
- var col = o.gridColElms[colIndex];
- col.style.width = w;
-
- var thCW = o.crWColsRow.cells[colIndex].clientWidth;
- var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth;
-
- if (thCW != tdCW /*&& !Helpers.isIE()*/) {
- o.headTbl.style.width = tbl.clientWidth + 'px';
- }
-
- if (afterColResizedFn) {
- afterColResizedFn.call(null, o, colIndex);
- }
- };
-
- if (tbl.clientWidth !== this.headTbl.clientWidth) {
- tbl.style.width = this.headTbl.clientWidth + 'px';
- }
-
- // Re-adjust reference row
- //tf.refRow = Helpers.isIE() ? (tf.refRow+1) : 0;
- }
- }, {
- key: 'destroy',
-
- /**
- * Removes the grid layout
- */
- value: function destroy() {
- var tf = this.tf;
- var tbl = tf.tbl;
-
- if (!tf.gridLayout) {
- return;
- }
- var t = tbl.parentNode.removeChild(tbl);
- this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont);
- this.tblMainCont.parentNode.removeChild(this.tblMainCont);
-
- this.tblMainCont = null;
- this.headTblCont = null;
- this.headTbl = null;
- this.tblCont = null;
-
- tbl.outerHTML = tf.sourceTblHtml;
- //needed to keep reference of table element
- tbl = _dom.Dom.id(tf.id);
- }
- }]);
-
- return GridLayout;
- })();
-
- exports.GridLayout = GridLayout;
-});
-//# sourceMappingURL=gridLayout.js.map
\ No newline at end of file
diff --git a/dev/modules/help.js b/dev/modules/help.js
deleted file mode 100644
index ad74dde1..00000000
--- a/dev/modules/help.js
+++ /dev/null
@@ -1,169 +0,0 @@
-define(['exports', '../dom', '../event'], function (exports, _dom, _event) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var Help = (function () {
-
- /**
- * Help UI component
- * @param {Object} tf TableFilter instance
- */
-
- function Help(tf) {
- _classCallCheck(this, Help);
-
- // Configuration object
- var f = tf.config();
-
- //id of custom container element for instructions
- this.helpInstrTgtId = f.help_instructions_target_id || null;
- //id of custom container element for instructions
- this.helpInstrContTgtId = f.help_instructions_container_target_id || null;
- //defines help text
- this.helpInstrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Avanced searches can be performed by using the following ' + 'operators: < , <= , > , ' + '>= , = , * , ! , { , } , ' + '|| ,&& , [empty] , [nonempty] , ' + 'rgx: These operators are described here: ' + 'http://tablefilter.free.fr/#operators
';
- //defines help innerHtml
- this.helpInstrHtml = f.help_instructions_html || null;
- //defines reset button text
- this.helpInstrBtnText = f.help_instructions_btn_text || '?';
- //defines reset button innerHtml
- this.helpInstrBtnHtml = f.help_instructions_btn_html || null;
- //defines css class for help button
- this.helpInstrBtnCssClass = f.help_instructions_btn_css_class || 'helpBtn';
- //defines css class for help container
- this.helpInstrContCssClass = f.help_instructions_container_css_class || 'helpCont';
- //help button element
- this.helpInstrBtnEl = null;
- //help content div
- this.helpInstrContEl = null;
- this.helpInstrDefaultHtml = '';
-
- //id prefix for help elements
- this.prfxHelpSpan = 'helpSpan_';
- //id prefix for help elements
- this.prfxHelpDiv = 'helpDiv_';
-
- this.tf = tf;
- }
-
- _createClass(Help, [{
- key: 'init',
- value: function init() {
- var _this = this;
-
- if (this.helpInstrBtnEl) {
- return;
- }
-
- var tf = this.tf;
-
- var helpspan = _dom.Dom.create('span', ['id', this.prfxHelpSpan + tf.id]);
- var helpdiv = _dom.Dom.create('div', ['id', this.prfxHelpDiv + tf.id]);
-
- //help button is added to defined element
- if (!this.helpInstrTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.helpInstrTgtId ? tf.rDiv : _dom.Dom.id(this.helpInstrTgtId);
- targetEl.appendChild(helpspan);
-
- var divContainer = !this.helpInstrContTgtId ? helpspan : _dom.Dom.id(this.helpInstrContTgtId);
-
- if (!this.helpInstrBtnHtml) {
- divContainer.appendChild(helpdiv);
- var helplink = _dom.Dom.create('a', ['href', 'javascript:void(0);']);
- helplink.className = this.helpInstrBtnCssClass;
- helplink.appendChild(_dom.Dom.text(this.helpInstrBtnText));
- helpspan.appendChild(helplink);
- _event.Event.add(helplink, 'click', function () {
- _this.toggle();
- });
- } else {
- helpspan.innerHTML = this.helpInstrBtnHtml;
- var helpEl = helpspan.firstChild;
- _event.Event.add(helpEl, 'click', function () {
- _this.toggle();
- });
- divContainer.appendChild(helpdiv);
- }
-
- if (!this.helpInstrHtml) {
- helpdiv.innerHTML = this.helpInstrText;
- helpdiv.className = this.helpInstrContCssClass;
- _event.Event.add(helpdiv, 'dblclick', function () {
- _this.toggle();
- });
- } else {
- if (this.helpInstrContTgtId) {
- divContainer.appendChild(helpdiv);
- }
- helpdiv.innerHTML = this.helpInstrHtml;
- if (!this.helpInstrContTgtId) {
- helpdiv.className = this.helpInstrContCssClass;
- _event.Event.add(helpdiv, 'dblclick', function () {
- _this.toggle();
- });
- }
- }
- helpdiv.innerHTML += this.helpInstrDefaultHtml;
- _event.Event.add(helpdiv, 'click', function () {
- _this.toggle();
- });
-
- this.helpInstrContEl = helpdiv;
- this.helpInstrBtnEl = helpspan;
- }
- }, {
- key: 'toggle',
-
- /**
- * Toggle help pop-up
- */
- value: function toggle() {
- if (!this.helpInstrContEl) {
- return;
- }
- var divDisplay = this.helpInstrContEl.style.display;
- if (divDisplay === '' || divDisplay === 'none') {
- this.helpInstrContEl.style.display = 'block';
- // TODO: use CSS instead for element positioning
- var btnLeft = _dom.Dom.position(this.helpInstrBtnEl).left;
- if (!this.helpInstrContTgtId) {
- this.helpInstrContEl.style.left = btnLeft - this.helpInstrContEl.clientWidth + 25 + 'px';
- }
- } else {
- this.helpInstrContEl.style.display = 'none';
- }
- }
- }, {
- key: 'destroy',
-
- /**
- * Remove help UI
- */
- value: function destroy() {
- if (!this.helpInstrBtnEl) {
- return;
- }
- this.helpInstrBtnEl.parentNode.removeChild(this.helpInstrBtnEl);
- this.helpInstrBtnEl = null;
- if (!this.helpInstrContEl) {
- return;
- }
- this.helpInstrContEl.parentNode.removeChild(this.helpInstrContEl);
- this.helpInstrContEl = null;
- }
- }]);
-
- return Help;
- })();
-
- exports.Help = Help;
-});
-//# sourceMappingURL=help.js.map
\ No newline at end of file
diff --git a/dev/modules/highlightKeywords.js b/dev/modules/highlightKeywords.js
deleted file mode 100644
index 427d3aca..00000000
--- a/dev/modules/highlightKeywords.js
+++ /dev/null
@@ -1,134 +0,0 @@
-define(['exports', '../dom', '../string'], function (exports, _dom, _string) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var HighlightKeyword = (function () {
-
- /**
- * HighlightKeyword, highlight matched keyword
- * @param {Object} tf TableFilter instance
- */
-
- function HighlightKeyword(tf) {
- _classCallCheck(this, HighlightKeyword);
-
- var f = tf.config();
- //defines css class for highlighting
- this.highlightCssClass = f.highlight_css_class || 'keyword';
- this.highlightedNodes = [];
-
- this.tf = tf;
- }
-
- _createClass(HighlightKeyword, [{
- key: 'highlight',
-
- /**
- * highlight occurences of searched term in passed node
- * @param {Node} node
- * @param {String} word Searched term
- * @param {String} cssClass Css class name
- */
- value: function highlight(node, word, cssClass) {
- // Iterate into this nodes childNodes
- if (node.hasChildNodes) {
- var children = node.childNodes;
- for (var i = 0; i < children.length; i++) {
- this.highlight(children[i], word, cssClass);
- }
- }
-
- if (node.nodeType === 3) {
- var tempNodeVal = _string.Str.lower(node.nodeValue);
- var tempWordVal = _string.Str.lower(word);
- if (tempNodeVal.indexOf(tempWordVal) != -1) {
- var pn = node.parentNode;
- if (pn && pn.className != cssClass) {
- // word not highlighted yet
- var nv = node.nodeValue,
- ni = tempNodeVal.indexOf(tempWordVal),
-
- // Create a load of replacement nodes
- before = _dom.Dom.text(nv.substr(0, ni)),
- docWordVal = nv.substr(ni, word.length),
- after = _dom.Dom.text(nv.substr(ni + word.length)),
- hiwordtext = _dom.Dom.text(docWordVal),
- hiword = _dom.Dom.create('span');
- hiword.className = cssClass;
- hiword.appendChild(hiwordtext);
- pn.insertBefore(before, node);
- pn.insertBefore(hiword, node);
- pn.insertBefore(after, node);
- pn.removeChild(node);
- this.highlightedNodes.push(hiword.firstChild);
- }
- }
- }
- }
- }, {
- key: 'unhighlight',
-
- /**
- * Removes highlight to nodes matching passed string
- * @param {String} word
- * @param {String} cssClass Css class to remove
- */
- value: function unhighlight(word, cssClass) {
- var arrRemove = [];
- var highlightedNodes = this.highlightedNodes;
- for (var i = 0; i < highlightedNodes.length; i++) {
- var n = highlightedNodes[i];
- if (!n) {
- continue;
- }
- var tempNodeVal = _string.Str.lower(n.nodeValue),
- tempWordVal = _string.Str.lower(word);
- if (tempNodeVal.indexOf(tempWordVal) !== -1) {
- var pn = n.parentNode;
- if (pn && pn.className === cssClass) {
- var prevSib = pn.previousSibling,
- nextSib = pn.nextSibling;
- if (!prevSib || !nextSib) {
- continue;
- }
- nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue;
- prevSib.nodeValue = '';
- n.nodeValue = '';
- arrRemove.push(i);
- }
- }
- }
- for (var k = 0; k < arrRemove.length; k++) {
- highlightedNodes.splice(arrRemove[k], 1);
- }
- }
- }, {
- key: 'unhighlightAll',
-
- /**
- * Clear all occurrences of highlighted nodes
- */
- value: function unhighlightAll() {
- if (!this.tf.highlightKeywords || !this.tf.searchArgs) {
- return;
- }
- for (var y = 0; y < this.tf.searchArgs.length; y++) {
- this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass);
- }
- this.highlightedNodes = [];
- }
- }]);
-
- return HighlightKeyword;
- })();
-
- exports.HighlightKeyword = HighlightKeyword;
-});
-//# sourceMappingURL=highlightKeywords.js.map
\ No newline at end of file
diff --git a/dev/modules/loader.js b/dev/modules/loader.js
deleted file mode 100644
index 131b03b6..00000000
--- a/dev/modules/loader.js
+++ /dev/null
@@ -1,106 +0,0 @@
-define(['exports', '../dom', '../types'], function (exports, _dom, _types) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var global = window;
-
- /**
- * Loading message/spinner
- * @param {Object} tf TableFilter instance
- */
-
- var Loader = (function () {
- function Loader(tf) {
- _classCallCheck(this, Loader);
-
- // TableFilter configuration
- var f = tf.config();
- //id of container element
- this.loaderTgtId = f.loader_target_id || null;
- //div containing loader
- this.loaderDiv = null;
- //defines loader text
- this.loaderText = f.loader_text || 'Loading...';
- //defines loader innerHtml
- this.loaderHtml = f.loader_html || null;
- //defines css class for loader div
- this.loaderCssClass = f.loader_css_class || 'loader';
- //delay for hiding loader
- this.loaderCloseDelay = 200;
- //callback function before loader is displayed
- this.onShowLoader = _types.Types.isFn(f.on_show_loader) ? f.on_show_loader : null;
- //callback function after loader is closed
- this.onHideLoader = _types.Types.isFn(f.on_hide_loader) ? f.on_hide_loader : null;
- //loader div
- this.prfxLoader = 'load_';
-
- this.tf = tf;
-
- var containerDiv = _dom.Dom.create('div', ['id', this.prfxLoader + tf.id]);
- containerDiv.className = this.loaderCssClass;
-
- var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _dom.Dom.id(this.loaderTgtId);
- if (!this.loaderTgtId) {
- targetEl.insertBefore(containerDiv, tf.tbl);
- } else {
- targetEl.appendChild(containerDiv);
- }
- this.loaderDiv = _dom.Dom.id(this.prfxLoader + tf.id);
- if (!this.loaderHtml) {
- this.loaderDiv.appendChild(_dom.Dom.text(this.loaderText));
- } else {
- this.loaderDiv.innerHTML = this.loaderHtml;
- }
- }
-
- _createClass(Loader, [{
- key: 'show',
- value: function show(p) {
- var _this = this;
-
- if (!this.tf.loader || !this.loaderDiv || this.loaderDiv.style.display === p) {
- return;
- }
-
- var displayLoader = function displayLoader() {
- if (!_this.loaderDiv) {
- return;
- }
- if (_this.onShowLoader && p !== 'none') {
- _this.onShowLoader.call(null, _this);
- }
- _this.loaderDiv.style.display = p;
- if (_this.onHideLoader && p === 'none') {
- _this.onHideLoader.call(null, _this);
- }
- };
-
- var t = p === 'none' ? this.loaderCloseDelay : 1;
- global.setTimeout(displayLoader, t);
- }
- }, {
- key: 'remove',
- value: function remove() {
- if (!this.loaderDiv) {
- return;
- }
- var tf = this.tf,
- targetEl = !this.loaderTgtId ? tf.gridLayout ? tf.Cpt.gridLayout.tblCont : tf.tbl.parentNode : _dom.Dom.id(this.loaderTgtId);
- targetEl.removeChild(this.loaderDiv);
- this.loaderDiv = null;
- }
- }]);
-
- return Loader;
- })();
-
- exports.Loader = Loader;
-});
-//# sourceMappingURL=loader.js.map
\ No newline at end of file
diff --git a/dev/modules/paging.js b/dev/modules/paging.js
deleted file mode 100644
index 631e64b5..00000000
--- a/dev/modules/paging.js
+++ /dev/null
@@ -1,760 +0,0 @@
-define(['exports', '../dom', '../types', '../string', '../helpers', '../event'], function (exports, _dom, _types, _string, _helpers, _event) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var Paging = (function () {
-
- /**
- * Pagination component
- * @param {Object} tf TableFilter instance
- */
-
- function Paging(tf) {
- _classCallCheck(this, Paging);
-
- // Configuration object
- var f = tf.config();
-
- //css class for paging buttons (previous,next,etc.)
- this.btnPageCssClass = f.paging_btn_css_class || 'pgInp';
- //stores paging select element
- this.pagingSlc = null;
- //results per page select element
- this.resultsPerPageSlc = null;
- //id of container element
- this.pagingTgtId = f.paging_target_id || null;
- //defines table paging length
- this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10;
- //id of container element
- this.resultsPerPageTgtId = f.results_per_page_target_id || null;
- //css class for paging select element
- this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc';
- //css class for paging input element
- this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp';
- //stores results per page text and values
- this.resultsPerPage = f.results_per_page || null;
- //enables/disables results per page drop-down
- this.hasResultsPerPage = _types.Types.isArray(this.resultsPerPage);
- //defines css class for results per page select
- this.resultsSlcCssClass = f.results_slc_css_class || 'rspg';
- //css class for label preceding results per page select
- this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan';
- //1st row index of current page
- this.startPagingRow = 0;
- //total nb of pages
- this.nbPages = 0;
- //current page nb
- this.currentPageNb = 1;
- //defines next page button text
- this.btnNextPageText = f.btn_next_page_text || '>';
- //defines previous page button text
- this.btnPrevPageText = f.btn_prev_page_text || '<';
- //defines last page button text
- this.btnLastPageText = f.btn_last_page_text || '>|';
- //defines first page button text
- this.btnFirstPageText = f.btn_first_page_text || '|<';
- //defines next page button html
- this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ' ');
- //defines previous page button html
- this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ' ');
- //defines last page button html
- this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ' ');
- //defines previous page button html
- this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ' ');
- //defines text preceeding page selector drop-down
- this.pageText = f.page_text || ' Page ';
- //defines text after page selector drop-down
- this.ofText = f.of_text || ' of ';
- //css class for span containing tot nb of pages
- this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg';
- //enables/disables paging buttons
- this.hasPagingBtns = f.paging_btns === false ? false : true;
- //defines previous page button html
- this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc;
- //calls function before page is changed
- this.onBeforeChangePage = _types.Types.isFn(f.on_before_change_page) ? f.on_before_change_page : null;
- //calls function before page is changed
- this.onAfterChangePage = _types.Types.isFn(f.on_after_change_page) ? f.on_after_change_page : null;
-
- //pages select
- this.prfxSlcPages = 'slcPages_';
- //results per page select
- this.prfxSlcResults = 'slcResults_';
- //label preciding results per page select
- this.prfxSlcResultsTxt = 'slcResultsTxt_';
- //span containing next page button
- this.prfxBtnNextSpan = 'btnNextSpan_';
- //span containing previous page button
- this.prfxBtnPrevSpan = 'btnPrevSpan_';
- //span containing last page button
- this.prfxBtnLastSpan = 'btnLastSpan_';
- //span containing first page button
- this.prfxBtnFirstSpan = 'btnFirstSpan_';
- //next button
- this.prfxBtnNext = 'btnNext_';
- //previous button
- this.prfxBtnPrev = 'btnPrev_';
- //last button
- this.prfxBtnLast = 'btnLast_';
- //first button
- this.prfxBtnFirst = 'btnFirst_';
- //span for tot nb pages
- this.prfxPgSpan = 'pgspan_';
- //span preceding pages select (contains 'Page')
- this.prfxPgBeforeSpan = 'pgbeforespan_';
- //span following pages select (contains ' of ')
- this.prfxPgAfterSpan = 'pgafterspan_';
-
- var start_row = this.refRow;
- var nrows = this.nbRows;
- //calculates page nb
- this.nbPages = Math.ceil((nrows - start_row) / this.pagingLength);
-
- //Paging elements events
- var o = this;
- // Paging DOM events
- this.evt = {
- slcIndex: function slcIndex() {
- return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1;
- },
- nbOpts: function nbOpts() {
- return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1;
- },
- next: function next() {
- var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0;
- o.changePage(nextIndex);
- },
- prev: function prev() {
- var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts();
- o.changePage(prevIndex);
- },
- last: function last() {
- o.changePage(o.evt.nbOpts());
- },
- first: function first() {
- o.changePage(0);
- },
- _detectKey: function _detectKey(e) {
- var key = _event.Event.keyCode(e);
- if (key === 13) {
- if (tf.sorted) {
- tf.filter();
- o.changePage(o.evt.slcIndex());
- } else {
- o.changePage();
- }
- this.blur();
- }
- },
- slcPagesChange: null,
- nextEvt: null,
- prevEvt: null,
- lastEvt: null,
- firstEvt: null
- };
-
- this.tf = tf;
- }
-
- _createClass(Paging, [{
- key: 'init',
-
- /**
- * Initialize DOM elements
- */
- value: function init() {
- var _this = this;
-
- var slcPages;
- var tf = this.tf;
- var evt = this.evt;
-
- // Check resultsPerPage is in expected format and initialise the
- // results per page component
- if (this.hasResultsPerPage) {
- if (this.resultsPerPage.length < 2) {
- this.hasResultsPerPage = false;
- } else {
- this.pagingLength = this.resultsPerPage[1][0];
- this.setResultsPerPage();
- }
- }
-
- /*====================================================
- - onchange event for paging select
- =====================================================*/
- evt.slcPagesChange = function (event) {
- _this.changePage();
- event.target.blur();
- };
-
- // Paging drop-down list selector
- if (this.pageSelectorType === tf.fltTypeSlc) {
- slcPages = _dom.Dom.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]);
- slcPages.className = this.pgSlcCssClass;
- _event.Event.add(slcPages, 'change', evt.slcPagesChange);
- }
-
- // Paging input selector
- if (this.pageSelectorType === tf.fltTypeInp) {
- slcPages = _dom.Dom.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]);
- slcPages.className = this.pgInpCssClass;
- _event.Event.add(slcPages, 'keypress', evt._detectKey);
- }
-
- // btns containers
- var btnNextSpan = _dom.Dom.create('span', ['id', this.prfxBtnNextSpan + tf.id]);
- var btnPrevSpan = _dom.Dom.create('span', ['id', this.prfxBtnPrevSpan + tf.id]);
- var btnLastSpan = _dom.Dom.create('span', ['id', this.prfxBtnLastSpan + tf.id]);
- var btnFirstSpan = _dom.Dom.create('span', ['id', this.prfxBtnFirstSpan + tf.id]);
-
- if (this.hasPagingBtns) {
- // Next button
- if (!this.btnNextPageHtml) {
- var btn_next = _dom.Dom.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']);
- btn_next.className = this.btnPageCssClass;
- _event.Event.add(btn_next, 'click', evt.next);
- btnNextSpan.appendChild(btn_next);
- } else {
- btnNextSpan.innerHTML = this.btnNextPageHtml;
- _event.Event.add(btnNextSpan, 'click', evt.next);
- }
- // Previous button
- if (!this.btnPrevPageHtml) {
- var btn_prev = _dom.Dom.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']);
- btn_prev.className = this.btnPageCssClass;
- _event.Event.add(btn_prev, 'click', evt.prev);
- btnPrevSpan.appendChild(btn_prev);
- } else {
- btnPrevSpan.innerHTML = this.btnPrevPageHtml;
- _event.Event.add(btnPrevSpan, 'click', evt.prev);
- }
- // Last button
- if (!this.btnLastPageHtml) {
- var btn_last = _dom.Dom.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']);
- btn_last.className = this.btnPageCssClass;
- _event.Event.add(btn_last, 'click', evt.last);
- btnLastSpan.appendChild(btn_last);
- } else {
- btnLastSpan.innerHTML = this.btnLastPageHtml;
- _event.Event.add(btnLastSpan, 'click', evt.last);
- }
- // First button
- if (!this.btnFirstPageHtml) {
- var btn_first = _dom.Dom.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']);
- btn_first.className = this.btnPageCssClass;
- _event.Event.add(btn_first, 'click', evt.first);
- btnFirstSpan.appendChild(btn_first);
- } else {
- btnFirstSpan.innerHTML = this.btnFirstPageHtml;
- _event.Event.add(btnFirstSpan, 'click', evt.first);
- }
- }
-
- // paging elements (buttons+drop-down list) are added to defined element
- if (!this.pagingTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.pagingTgtId ? tf.mDiv : _dom.Dom.id(this.pagingTgtId);
- targetEl.appendChild(btnFirstSpan);
- targetEl.appendChild(btnPrevSpan);
-
- var pgBeforeSpan = _dom.Dom.create('span', ['id', this.prfxPgBeforeSpan + tf.id]);
- pgBeforeSpan.appendChild(_dom.Dom.text(this.pageText));
- pgBeforeSpan.className = this.nbPgSpanCssClass;
- targetEl.appendChild(pgBeforeSpan);
- targetEl.appendChild(slcPages);
- var pgAfterSpan = _dom.Dom.create('span', ['id', this.prfxPgAfterSpan + tf.id]);
- pgAfterSpan.appendChild(_dom.Dom.text(this.ofText));
- pgAfterSpan.className = this.nbPgSpanCssClass;
- targetEl.appendChild(pgAfterSpan);
- var pgspan = _dom.Dom.create('span', ['id', this.prfxPgSpan + tf.id]);
- pgspan.className = this.nbPgSpanCssClass;
- pgspan.appendChild(_dom.Dom.text(' ' + this.nbPages + ' '));
- targetEl.appendChild(pgspan);
- targetEl.appendChild(btnNextSpan);
- targetEl.appendChild(btnLastSpan);
- this.pagingSlc = _dom.Dom.id(this.prfxSlcPages + tf.id);
-
- // if this.rememberGridValues==true this.setPagingInfo() is called
- // in ResetGridValues() method
- if (!tf.rememberGridValues || this.isPagingRemoved) {
- this.setPagingInfo();
- }
- if (!tf.fltGrid) {
- tf.ValidateAllRows();
- this.setPagingInfo(tf.validRowsIndex);
- }
-
- this.isPagingRemoved = false;
- }
- }, {
- key: 'addPaging',
-
- /**
- * Add paging when filters are already instanciated
- * @param {Boolean} filterTable Execute filtering once paging instanciated
- */
- value: function addPaging() {
- var filterTable = arguments[0] === undefined ? false : arguments[0];
-
- var tf = this.tf;
- if (!tf.hasGrid() || tf.paging) {
- return;
- }
- tf.paging = true;
- this.isPagingRemoved = true;
- this.init();
- tf.resetValues();
- if (filterTable) {
- tf.filter();
- }
- }
- }, {
- key: 'setPagingInfo',
-
- /**
- * Calculate number of pages based on valid rows
- * Refresh paging select according to number of pages
- * @param {Array} validRows Collection of valid rows
- */
- value: function setPagingInfo(validRows) {
- var tf = this.tf;
- var rows = tf.tbl.rows;
- var mdiv = !this.pagingTgtId ? tf.mDiv : _dom.Dom.id(this.pagingTgtId);
- var pgspan = _dom.Dom.id(this.prfxPgSpan + tf.id);
- //stores valid rows indexes
- if (validRows && validRows.length > 0) {
- tf.validRowsIndex = validRows;
- } else {
- //re-sets valid rows indexes array
- tf.validRowsIndex = [];
-
- //counts rows to be grouped
- for (var j = tf.refRow; j < tf.nbRows; j++) {
- var row = rows[j];
- if (!row) {
- continue;
- }
- var isRowValid = row.getAttribute('validRow');
- if (isRowValid === 'true' || !isRowValid) {
- tf.validRowsIndex.push(j);
- }
- }
- }
-
- //calculate nb of pages
- this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength);
- //refresh page nb span
- pgspan.innerHTML = this.nbPages;
- //select clearing shortcut
- if (this.pageSelectorType === tf.fltTypeSlc) {
- this.pagingSlc.innerHTML = '';
- }
-
- if (this.nbPages > 0) {
- mdiv.style.visibility = 'visible';
- if (this.pageSelectorType === tf.fltTypeSlc) {
- for (var z = 0; z < this.nbPages; z++) {
- var currOpt = new Option(z + 1, z * this.pagingLength, false, false);
- this.pagingSlc.options[z] = currOpt;
- }
- } else {
- //input type
- this.pagingSlc.value = this.currentPageNb;
- }
- } else {
- /*** if no results paging select and buttons are hidden ***/
- mdiv.style.visibility = 'hidden';
- }
- this.groupByPage(tf.validRowsIndex);
- }
- }, {
- key: 'groupByPage',
-
- /**
- * Group table rows by page and display valid rows
- * @param {Array} validRows Collection of valid rows
- */
- value: function groupByPage(validRows) {
- var tf = this.tf;
- var rows = tf.tbl.rows;
- var paging_end_row = parseInt(this.startPagingRow, 10) + parseInt(this.pagingLength, 10);
-
- //store valid rows indexes
- if (validRows) {
- tf.validRowsIndex = validRows;
- }
-
- //this loop shows valid rows of current page
- for (var h = 0; h < tf.validRowsIndex.length; h++) {
- var r = rows[tf.validRowsIndex[h]];
- if (h >= this.startPagingRow && h < paging_end_row) {
- if (r.getAttribute('validRow') === 'true' || !r.getAttribute('validRow')) {
- r.style.display = '';
- }
- if (tf.alternateBgs && tf.Cpt.alternateRows) {
- tf.Cpt.alternateRows.setRowBg(tf.validRowsIndex[h], h);
- }
- } else {
- r.style.display = 'none';
- if (tf.alternateBgs && tf.Cpt.alternateRows) {
- tf.Cpt.alternateRows.removeRowBg(tf.validRowsIndex[h]);
- }
- }
- }
-
- tf.nbVisibleRows = tf.validRowsIndex.length;
- tf.isStartBgAlternate = false;
- //re-applies filter behaviours after filtering process
- tf.applyGridProps();
- }
- }, {
- key: 'setPage',
-
- /**
- * Show page based on passed param value (string or number):
- * @param {String} or {Number} cmd possible string values: 'next',
- * 'previous', 'last', 'first' or page number as per param
- */
- value: function setPage(cmd) {
- var tf = this.tf;
- if (!tf.hasGrid() || !tf.paging) {
- return;
- }
- var btnEvt = this.evt,
- cmdtype = typeof cmd;
- if (cmdtype === 'string') {
- switch (_string.Str.lower(cmd)) {
- case 'next':
- btnEvt.next();
- break;
- case 'previous':
- btnEvt.prev();
- break;
- case 'last':
- btnEvt.last();
- break;
- case 'first':
- btnEvt.first();
- break;
- default:
- btnEvt.next();
- break;
- }
- } else if (cmdtype === 'number') {
- this.changePage(cmd - 1);
- }
- }
- }, {
- key: 'setResultsPerPage',
-
- /**
- * Generates UI elements for the number of results per page drop-down
- */
- value: function setResultsPerPage() {
- var _this2 = this;
-
- var tf = this.tf;
- var evt = this.evt;
-
- if (!tf.hasGrid() && !tf.isFirstLoad) {
- return;
- }
- if (this.resultsPerPageSlc || !this.resultsPerPage) {
- return;
- }
-
- /*====================================================
- - onchange event for results per page select
- =====================================================*/
- evt.slcResultsChange = function (ev) {
- _this2.changeResultsPerPage();
- ev.target.blur();
- };
-
- var slcR = _dom.Dom.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]);
- slcR.className = tf.resultsSlcCssClass;
- var slcRText = this.resultsPerPage[0],
- slcROpts = this.resultsPerPage[1];
- var slcRSpan = _dom.Dom.create('span', ['id', this.prfxSlcResultsTxt + tf.id]);
- slcRSpan.className = this.resultsSpanCssClass;
-
- // results per page select is added to external element
- if (!this.resultsPerPageTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _dom.Dom.id(this.resultsPerPageTgtId);
- slcRSpan.appendChild(_dom.Dom.text(slcRText));
- targetEl.appendChild(slcRSpan);
- targetEl.appendChild(slcR);
-
- this.resultsPerPageSlc = _dom.Dom.id(this.prfxSlcResults + tf.id);
-
- for (var r = 0; r < slcROpts.length; r++) {
- var currOpt = new Option(slcROpts[r], slcROpts[r], false, false);
- this.resultsPerPageSlc.options[r] = currOpt;
- }
- _event.Event.add(slcR, 'change', evt.slcResultsChange);
- }
- }, {
- key: 'removeResultsPerPage',
-
- /**
- * Remove number of results per page UI elements
- */
- value: function removeResultsPerPage() {
- var tf = this.tf;
- if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) {
- return;
- }
- var slcR = this.resultsPerPageSlc,
- slcRSpan = _dom.Dom.id(this.prfxSlcResultsTxt + tf.id);
- if (slcR) {
- slcR.parentNode.removeChild(slcR);
- }
- if (slcRSpan) {
- slcRSpan.parentNode.removeChild(slcRSpan);
- }
- this.resultsPerPageSlc = null;
- }
- }, {
- key: 'changePage',
-
- /**
- * Change the page asynchronously according to passed index
- * @param {Number} index Index of the page (0-n)
- */
- value: function changePage(index) {
- var tf = this.tf;
- var evt = tf.Evt;
- tf.EvtManager(evt.name.changepage, { pgIndex: index });
- }
- }, {
- key: 'changeResultsPerPage',
-
- /**
- * Change rows asynchronously according to page results
- */
- value: function changeResultsPerPage() {
- var tf = this.tf;
- var evt = tf.Evt;
- tf.EvtManager(evt.name.changeresultsperpage);
- }
- }, {
- key: 'resetPage',
-
- /**
- * Re-set asynchronously page nb at page re-load
- */
- value: function resetPage() {
- var tf = this.tf;
- var evt = tf.Evt;
- tf.EvtManager(evt.name.resetpage);
- }
- }, {
- key: 'resetPageLength',
-
- /**
- * Re-set asynchronously page length at page re-load
- */
- value: function resetPageLength() {
- var tf = this.tf;
- var evt = tf.Evt;
- tf.EvtManager(evt.name.resetpagelength);
- }
- }, {
- key: '_changePage',
-
- /**
- * Change the page according to passed index
- * @param {Number} index Index of the page (0-n)
- */
- value: function _changePage(index) {
- var tf = this.tf;
-
- if (!tf.paging) {
- return;
- }
- if (index === null) {
- index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1;
- }
- if (index >= 0 && index <= this.nbPages - 1) {
- if (this.onBeforeChangePage) {
- this.onBeforeChangePage.call(null, this, index);
- }
- this.currentPageNb = parseInt(index, 10) + 1;
- if (this.pageSelectorType === tf.fltTypeSlc) {
- this.pagingSlc.options[index].selected = true;
- } else {
- this.pagingSlc.value = this.currentPageNb;
- }
-
- if (tf.rememberPageNb) {
- tf.Cpt.store.savePageNb(tf.pgNbCookie);
- }
- this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength;
-
- this.groupByPage();
-
- if (this.onAfterChangePage) {
- this.onAfterChangePage.call(null, this, index);
- }
- }
- }
- }, {
- key: '_changeResultsPerPage',
-
- /**
- * Change rows according to page results
- */
- value: function _changeResultsPerPage() {
- var tf = this.tf;
-
- if (!tf.paging) {
- return;
- }
- var slcR = this.resultsPerPageSlc;
- var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10);
- this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10);
- this.startPagingRow = this.pagingLength * slcPagesSelIndex;
-
- if (!isNaN(this.pagingLength)) {
- if (this.startPagingRow >= tf.nbFilterableRows) {
- this.startPagingRow = tf.nbFilterableRows - this.pagingLength;
- }
- this.setPagingInfo();
-
- if (this.pageSelectorType === tf.fltTypeSlc) {
- var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex;
- this.pagingSlc.options[slcIndex].selected = true;
- }
- if (tf.rememberPageLen) {
- tf.Cpt.store.savePageLength(tf.pgLenCookie);
- }
- }
- }
- }, {
- key: '_resetPage',
-
- /**
- * Re-set page nb at page re-load
- */
- value: function _resetPage(name) {
- var tf = this.tf;
- var pgnb = tf.Cpt.store.getPageNb(name);
- if (pgnb !== '') {
- this.changePage(pgnb - 1);
- }
- }
- }, {
- key: '_resetPageLength',
-
- /**
- * Re-set page length at page re-load
- */
- value: function _resetPageLength(name) {
- var tf = this.tf;
- if (!tf.paging) {
- return;
- }
- var pglenIndex = tf.Cpt.store.getPageLength(name);
-
- if (pglenIndex !== '') {
- this.resultsPerPageSlc.options[pglenIndex].selected = true;
- this.changeResultsPerPage();
- }
- }
- }, {
- key: 'destroy',
-
- /**
- * Remove paging feature
- */
- value: function destroy() {
- var tf = this.tf;
-
- if (!tf.hasGrid()) {
- return;
- }
- // btns containers
- var btnNextSpan, btnPrevSpan, btnLastSpan, btnFirstSpan;
- var pgBeforeSpan, pgAfterSpan, pgspan;
- btnNextSpan = _dom.Dom.id(this.prfxBtnNextSpan + tf.id);
- btnPrevSpan = _dom.Dom.id(this.prfxBtnPrevSpan + tf.id);
- btnLastSpan = _dom.Dom.id(this.prfxBtnLastSpan + tf.id);
- btnFirstSpan = _dom.Dom.id(this.prfxBtnFirstSpan + tf.id);
- //span containing 'Page' text
- pgBeforeSpan = _dom.Dom.id(this.prfxPgBeforeSpan + tf.id);
- //span containing 'of' text
- pgAfterSpan = _dom.Dom.id(this.prfxPgAfterSpan + tf.id);
- //span containing nb of pages
- pgspan = _dom.Dom.id(this.prfxPgSpan + tf.id);
-
- var evt = this.evt;
-
- if (this.pagingSlc) {
- if (this.pageSelectorType === tf.fltTypeSlc) {
- _event.Event.remove(this.pagingSlc, 'change', evt.slcPagesChange);
- } else if (this.pageSelectorType === tf.fltTypeInp) {
- _event.Event.remove(this.pagingSlc, 'keypress', evt._detectKey);
- }
- this.pagingSlc.parentNode.removeChild(this.pagingSlc);
- }
-
- if (btnNextSpan) {
- _event.Event.remove(btnNextSpan, 'click', evt.next);
- btnNextSpan.parentNode.removeChild(btnNextSpan);
- }
-
- if (btnPrevSpan) {
- _event.Event.remove(btnPrevSpan, 'click', evt.prev);
- btnPrevSpan.parentNode.removeChild(btnPrevSpan);
- }
-
- if (btnLastSpan) {
- _event.Event.remove(btnLastSpan, 'click', evt.last);
- btnLastSpan.parentNode.removeChild(btnLastSpan);
- }
-
- if (btnFirstSpan) {
- _event.Event.remove(btnFirstSpan, 'click', evt.first);
- btnFirstSpan.parentNode.removeChild(btnFirstSpan);
- }
-
- if (pgBeforeSpan) {
- pgBeforeSpan.parentNode.removeChild(pgBeforeSpan);
- }
-
- if (pgAfterSpan) {
- pgAfterSpan.parentNode.removeChild(pgAfterSpan);
- }
-
- if (pgspan) {
- pgspan.parentNode.removeChild(pgspan);
- }
-
- if (this.hasResultsPerPage) {
- this.removeResultsPerPage();
- }
-
- this.pagingSlc = null;
- this.nbPages = 0;
- this.isPagingRemoved = true;
- tf.paging = false;
- }
- }]);
-
- return Paging;
- })();
-
- exports.Paging = Paging;
-});
-//# sourceMappingURL=paging.js.map
\ No newline at end of file
diff --git a/dev/modules/popupFilter.js b/dev/modules/popupFilter.js
deleted file mode 100644
index 20dcda26..00000000
--- a/dev/modules/popupFilter.js
+++ /dev/null
@@ -1,255 +0,0 @@
-define(['exports', '../types', '../dom', '../event', '../helpers'], function (exports, _types, _dom, _event, _helpers) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var PopupFilter = (function () {
-
- /**
- * Pop-up filter component
- * @param {Object} tf TableFilter instance
- */
-
- function PopupFilter(tf) {
- _classCallCheck(this, PopupFilter);
-
- // Configuration object
- var f = tf.config();
-
- // Enable external filters behaviour
- tf.isExternalFlt = true;
- tf.externalFltTgtIds = [];
-
- //filter icon path
- this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif';
- //active filter icon path
- this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif';
- this.popUpImgFltHtml = f.popup_filters_image_html || ' ';
- //defines css class for popup div containing filter
- this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter';
- //callback function before popup filtes is opened
- this.onBeforePopUpOpen = _types.Types.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null;
- //callback function after popup filtes is opened
- this.onAfterPopUpOpen = _types.Types.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null;
- //callback function before popup filtes is closed
- this.onBeforePopUpClose = _types.Types.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null;
- //callback function after popup filtes is closed
- this.onAfterPopUpClose = _types.Types.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null;
-
- //stores filters spans
- this.popUpFltSpans = [];
- //stores filters icons
- this.popUpFltImgs = [];
- //stores filters containers
- this.popUpFltElms = this.popUpFltElmCache || [];
- this.popUpFltAdjustToContainer = true;
-
- //id prefix for pop-up filter span
- this.prfxPopUpSpan = 'popUpSpan_';
- //id prefix for pop-up div containing filter
- this.prfxPopUpDiv = 'popUpDiv_';
-
- this.tf = tf;
- }
-
- _createClass(PopupFilter, [{
- key: 'onClick',
- value: function onClick(e) {
- var evt = e || global.event,
- elm = evt.target.parentNode,
- colIndex = parseInt(elm.getAttribute('ci'), 10);
-
- this.closeAll(colIndex);
- this.toggle(colIndex);
-
- if (this.popUpFltAdjustToContainer) {
- var popUpDiv = this.popUpFltElms[colIndex],
- header = this.tf.getHeaderElement(colIndex),
- headerWidth = header.clientWidth * 0.95;
- if (_helpers.Helpers.isIE()) {
- var headerLeft = _dom.Dom.position(header).left;
- popUpDiv.style.left = headerLeft + 'px';
- }
- popUpDiv.style.width = parseInt(headerWidth, 10) + 'px';
- }
- _event.Event.cancel(evt);
- _event.Event.stop(evt);
- }
- }, {
- key: 'init',
-
- /**
- * Initialize DOM elements
- */
- value: function init() {
- var _this = this;
-
- var tf = this.tf;
- for (var i = 0; i < tf.nbCells; i++) {
- if (tf['col' + i] === tf.fltTypeNone) {
- continue;
- }
- var popUpSpan = _dom.Dom.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]);
- popUpSpan.innerHTML = this.popUpImgFltHtml;
- var header = tf.getHeaderElement(i);
- header.appendChild(popUpSpan);
- _event.Event.add(popUpSpan, 'click', function (evt) {
- _this.onClick(evt);
- });
- this.popUpFltSpans[i] = popUpSpan;
- this.popUpFltImgs[i] = popUpSpan.firstChild;
- }
- }
- }, {
- key: 'buildAll',
-
- /**
- * Build all pop-up filters elements
- */
- value: function buildAll() {
- for (var i = 0; i < this.popUpFltElmCache.length; i++) {
- this.build(i, this.popUpFltElmCache[i]);
- }
- }
- }, {
- key: 'build',
-
- /**
- * Build a specified pop-up filter elements
- * @param {Number} colIndex Column index
- * @param {Object} div Optional container DOM element
- */
- value: function build(colIndex, div) {
- var tf = this.tf;
- var popUpDiv = !div ? _dom.Dom.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div;
- popUpDiv.className = this.popUpDivCssClass;
- tf.externalFltTgtIds.push(popUpDiv.id);
- var header = tf.getHeaderElement(colIndex);
- header.insertBefore(popUpDiv, header.firstChild);
- _event.Event.add(popUpDiv, 'click', function (evt) {
- _event.Event.stop(evt);
- });
- this.popUpFltElms[colIndex] = popUpDiv;
- }
- }, {
- key: 'toggle',
-
- /**
- * Toogle visibility of specified filter
- * @param {Number} colIndex Column index
- */
- value: function toggle(colIndex) {
- var tf = this.tf,
- popUpFltElm = this.popUpFltElms[colIndex];
-
- if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') {
- if (this.onBeforePopUpOpen) {
- this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex);
- }
- popUpFltElm.style.display = 'block';
- if (tf['col' + colIndex] === tf.fltTypeInp) {
- var flt = tf.getFilterElement(colIndex);
- if (flt) {
- flt.focus();
- }
- }
- if (this.onAfterPopUpOpen) {
- this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex);
- }
- } else {
- if (this.onBeforePopUpClose) {
- this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex);
- }
- popUpFltElm.style.display = 'none';
- if (this.onAfterPopUpClose) {
- this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex);
- }
- }
- }
- }, {
- key: 'closeAll',
-
- /**
- * Close all filters excepted for the specified one if any
- * @param {Number} exceptIdx Column index of the filter to not close
- */
- value: function closeAll(exceptIdx) {
- for (var i = 0; i < this.popUpFltElms.length; i++) {
- if (i === exceptIdx) {
- continue;
- }
- var popUpFltElm = this.popUpFltElms[i];
- if (popUpFltElm) {
- popUpFltElm.style.display = 'none';
- }
- }
- }
- }, {
- key: 'buildIcons',
-
- /**
- * Build all the icons representing the pop-up filters
- */
- value: function buildIcons() {
- for (var i = 0; i < this.popUpFltImgs.length; i++) {
- this.buildIcon(i, false);
- }
- }
- }, {
- key: 'buildIcon',
-
- /**
- * Build specified icon
- * @param {Number} colIndex Column index
- * @param {Boolean} active Apply active state
- */
- value: function buildIcon(colIndex, active) {
- var activeImg = _types.Types.isUndef(active) ? true : active;
- if (this.popUpFltImgs[colIndex]) {
- this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt;
- }
- }
- }, {
- key: 'destroy',
-
- /**
- * Remove pop-up filters
- */
- value: function destroy() {
- this.popUpFltElmCache = [];
- for (var i = 0; i < this.popUpFltElms.length; i++) {
- var popUpFltElm = this.popUpFltElms[i],
- popUpFltSpan = this.popUpFltSpans[i],
- popUpFltImg = this.popUpFltImgs[i];
- if (popUpFltElm) {
- popUpFltElm.parentNode.removeChild(popUpFltElm);
- this.popUpFltElmCache[i] = popUpFltElm;
- }
- popUpFltElm = null;
- if (popUpFltSpan) {
- popUpFltSpan.parentNode.removeChild(popUpFltSpan);
- }
- popUpFltSpan = null;
- if (popUpFltImg) {
- popUpFltImg.parentNode.removeChild(popUpFltImg);
- }
- popUpFltImg = null;
- }
- this.popUpFltElms = [];
- this.popUpFltSpans = [];
- this.popUpFltImgs = [];
- }
- }]);
-
- return PopupFilter;
- })();
-
- exports.PopupFilter = PopupFilter;
-});
-//# sourceMappingURL=popupFilter.js.map
\ No newline at end of file
diff --git a/dev/modules/rowsCounter.js b/dev/modules/rowsCounter.js
deleted file mode 100644
index bf7acdf3..00000000
--- a/dev/modules/rowsCounter.js
+++ /dev/null
@@ -1,158 +0,0 @@
-define(['exports', '../dom', '../types', '../helpers'], function (exports, _dom, _types, _helpers) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var RowsCounter = (function () {
-
- /**
- * Rows counter
- * @param {Object} tf TableFilter instance
- */
-
- function RowsCounter(tf) {
- _classCallCheck(this, RowsCounter);
-
- // TableFilter configuration
- var f = tf.config();
-
- //id of custom container element
- this.rowsCounterTgtId = f.rows_counter_target_id || null;
- //element containing tot nb rows
- this.rowsCounterDiv = null;
- //element containing tot nb rows label
- this.rowsCounterSpan = null;
- //defines rows counter text
- this.rowsCounterText = f.rows_counter_text || 'Rows: ';
- this.fromToTextSeparator = f.from_to_text_separator || '-';
- this.overText = f.over_text || ' / ';
- //defines css class rows counter
- this.totRowsCssClass = f.tot_rows_css_class || 'tot';
- //rows counter div
- this.prfxCounter = 'counter_';
- //nb displayed rows label
- this.prfxTotRows = 'totrows_span_';
- //label preceding nb rows label
- this.prfxTotRowsTxt = 'totRowsTextSpan_';
- //callback raised before counter is refreshed
- this.onBeforeRefreshCounter = _types.Types.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null;
- //callback raised after counter is refreshed
- this.onAfterRefreshCounter = _types.Types.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null;
-
- this.tf = tf;
- }
-
- _createClass(RowsCounter, [{
- key: 'init',
- value: function init() {
- var tf = this.tf;
-
- if (!tf.hasGrid() && !tf.isFirstLoad || this.rowsCounterSpan) {
- return;
- }
-
- //rows counter container
- var countDiv = _dom.Dom.create('div', ['id', this.prfxCounter + tf.id]);
- countDiv.className = this.totRowsCssClass;
- //rows counter label
- var countSpan = _dom.Dom.create('span', ['id', this.prfxTotRows + tf.id]);
- var countText = _dom.Dom.create('span', ['id', this.prfxTotRowsTxt + tf.id]);
- countText.appendChild(_dom.Dom.text(this.rowsCounterText));
-
- // counter is added to defined element
- if (!this.rowsCounterTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _dom.Dom.id(this.rowsCounterTgtId);
-
- //IE only: clears all for sure
- if (this.rowsCounterDiv && _helpers.Helpers.isIE()) {
- this.rowsCounterDiv.outerHTML = '';
- }
- //default container: 'lDiv'
- if (!this.rowsCounterTgtId) {
- countDiv.appendChild(countText);
- countDiv.appendChild(countSpan);
- targetEl.appendChild(countDiv);
- } else {
- //custom container, no need to append statusDiv
- targetEl.appendChild(countText);
- targetEl.appendChild(countSpan);
- }
- this.rowsCounterDiv = countDiv;
- this.rowsCounterSpan = countSpan;
-
- this.refresh();
- }
- }, {
- key: 'refresh',
- value: function refresh(p) {
- if (!this.rowsCounterSpan) {
- return;
- }
-
- var tf = this.tf;
-
- if (this.onBeforeRefreshCounter) {
- this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan);
- }
-
- var totTxt;
- if (!tf.paging) {
- if (p && p !== '') {
- totTxt = p;
- } else {
- totTxt = tf.nbFilterableRows - tf.nbHiddenRows - (tf.hasVisibleRows ? tf.visibleRows.length : 0);
- }
- } else {
- var paging = tf.Cpt.paging;
- if (paging) {
- //paging start row
- var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0);
- var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows;
- totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows;
- }
- }
- this.rowsCounterSpan.innerHTML = totTxt;
- if (this.onAfterRefreshCounter) {
- this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt);
- }
- }
- }, {
- key: 'destroy',
- value: function destroy() {
- var tf = this.tf;
- if (!tf.hasGrid()) {
- return;
- }
- if (!this.rowsCounterSpan) {
- return;
- }
-
- if (!this.rowsCounterTgtId && this.rowsCounterDiv) {
- //IE only: clears all for sure
- if (_helpers.Helpers.isIE()) {
- this.rowsCounterDiv.outerHTML = '';
- } else {
- this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv);
- }
- } else {
- _dom.Dom.id(this.rowsCounterTgtId).innerHTML = '';
- }
- this.rowsCounterSpan = null;
- this.rowsCounterDiv = null;
- }
- }]);
-
- return RowsCounter;
- })();
-
- exports.RowsCounter = RowsCounter;
-});
-//# sourceMappingURL=rowsCounter.js.map
\ No newline at end of file
diff --git a/dev/modules/statusBar.js b/dev/modules/statusBar.js
deleted file mode 100644
index df036009..00000000
--- a/dev/modules/statusBar.js
+++ /dev/null
@@ -1,145 +0,0 @@
-define(['exports', '../dom', '../event', '../types', '../helpers'], function (exports, _dom, _event, _types, _helpers) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var global = window;
-
- var StatusBar = (function () {
-
- /**
- * Status bar UI component
- * @param {Object} tf TableFilter instance
- */
-
- function StatusBar(tf) {
- _classCallCheck(this, StatusBar);
-
- // Configuration object
- var f = tf.config();
-
- //id of custom container element
- this.statusBarTgtId = f.status_bar_target_id || null;
- //element containing status bar label
- this.statusBarDiv = null;
- //status bar
- this.statusBarSpan = null;
- //status bar label
- this.statusBarSpanText = null;
- //defines status bar text
- this.statusBarText = f.status_bar_text || '';
- //defines css class status bar
- this.statusBarCssClass = f.status_bar_css_class || 'status';
- //delay for status bar clearing
- this.statusBarCloseDelay = 250;
-
- //calls function before message is displayed
- this.onBeforeShowMsg = _types.Types.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null;
- //calls function after message is displayed
- this.onAfterShowMsg = _types.Types.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null;
-
- // status bar div
- this.prfxStatus = 'status_';
- // status bar label
- this.prfxStatusSpan = 'statusSpan_';
- // text preceding status bar label
- this.prfxStatusTxt = 'statusText_';
-
- this.tf = tf;
- }
-
- _createClass(StatusBar, [{
- key: 'init',
- value: function init() {
- var tf = this.tf;
- if (!tf.hasGrid() && !tf.isFirstLoad) {
- return;
- }
-
- //status bar container
- var statusDiv = _dom.Dom.create('div', ['id', this.prfxStatus + tf.id]);
- statusDiv.className = this.statusBarCssClass;
-
- //status bar label
- var statusSpan = _dom.Dom.create('span', ['id', this.prfxStatusSpan + tf.id]);
- //preceding text
- var statusSpanText = _dom.Dom.create('span', ['id', this.prfxStatusTxt + tf.id]);
- statusSpanText.appendChild(_dom.Dom.text(this.statusBarText));
-
- // target element container
- if (!this.statusBarTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.statusBarTgtId ? tf.lDiv : _dom.Dom.id(this.statusBarTgtId);
-
- // TODO: use alternative to outerHTML
- if (this.statusBarDiv && _helpers.Helpers.isIE()) {
- this.statusBarDiv.outerHTML = '';
- }
-
- //default container: 'lDiv'
- if (!this.statusBarTgtId) {
- statusDiv.appendChild(statusSpanText);
- statusDiv.appendChild(statusSpan);
- targetEl.appendChild(statusDiv);
- } else {
- // custom container, no need to append statusDiv
- targetEl.appendChild(statusSpanText);
- targetEl.appendChild(statusSpan);
- }
-
- this.statusBarDiv = statusDiv;
- this.statusBarSpan = statusSpan;
- this.statusBarSpanText = statusSpanText;
- }
- }, {
- key: 'message',
- value: function message() {
- var _this = this;
-
- var t = arguments[0] === undefined ? '' : arguments[0];
-
- var tf = this.tf;
- if (!tf.statusBar || !this.statusBarSpan) {
- return;
- }
- if (this.onBeforeShowMsg) {
- this.onBeforeShowMsg.call(null, this.tf, t);
- }
-
- var d = t === '' ? this.statusBarCloseDelay : 1;
- global.setTimeout(function () {
- _this.statusBarSpan.innerHTML = t;
- if (_this.onAfterShowMsg) {
- _this.onAfterShowMsg.call(null, _this.tf, t);
- }
- }, d);
- }
- }, {
- key: 'destroy',
- value: function destroy() {
- var tf = this.tf;
- if (!tf.hasGrid() || !this.statusBarDiv) {
- return;
- }
-
- this.statusBarDiv.innerHTML = '';
- this.statusBarDiv.parentNode.removeChild(this.statusBarDiv);
- this.statusBarSpan = null;
- this.statusBarSpanText = null;
- this.statusBarDiv = null;
- }
- }]);
-
- return StatusBar;
- })();
-
- exports.StatusBar = StatusBar;
-});
-//# sourceMappingURL=statusBar.js.map
\ No newline at end of file
diff --git a/dev/modules/store.js b/dev/modules/store.js
deleted file mode 100644
index b9d7f94d..00000000
--- a/dev/modules/store.js
+++ /dev/null
@@ -1,116 +0,0 @@
-define(['exports', '../cookie'], function (exports, _cookie) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var Store = (function () {
-
- /**
- * Store, persistence manager
- * @param {Object} tf TableFilter instance
- */
-
- function Store(tf) {
- _classCallCheck(this, Store);
-
- var f = tf.config();
-
- this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000;
-
- this.tf = tf;
- }
-
- _createClass(Store, [{
- key: 'saveFilterValues',
-
- /**
- * Store filters' values in cookie
- * @param {String} cookie name
- */
- value: function saveFilterValues(name) {
- var tf = this.tf;
- var fltValues = [];
- //store filters' values
- for (var i = 0; i < tf.fltIds.length; i++) {
- var value = tf.getFilterValue(i);
- if (value === '') {
- value = ' ';
- }
- fltValues.push(value);
- }
- //adds array size
- fltValues.push(tf.fltIds.length);
-
- //writes cookie
- _cookie.Cookie.write(name, fltValues.join(tf.separator), this.duration);
- }
- }, {
- key: 'getFilterValues',
-
- /**
- * Retrieve filters' values from cookie
- * @param {String} cookie name
- * @return {Array}
- */
- value: function getFilterValues(name) {
- var flts = _cookie.Cookie.read(name);
- var rgx = new RegExp(this.tf.separator, 'g');
- // filters' values array
- return flts.split(rgx);
- }
- }, {
- key: 'savePageNb',
-
- /**
- * Store page number in cookie
- * @param {String} cookie name
- */
- value: function savePageNb(name) {
- _cookie.Cookie.write(name, this.tf.Cpt.paging.currentPageNb, this.duration);
- }
- }, {
- key: 'getPageNb',
-
- /**
- * Retrieve page number from cookie
- * @param {String} cookie name
- * @return {String}
- */
- value: function getPageNb(name) {
- return _cookie.Cookie.read(name);
- }
- }, {
- key: 'savePageLength',
-
- /**
- * Store page length in cookie
- * @param {String} cookie name
- */
- value: function savePageLength(name) {
- _cookie.Cookie.write(name, this.tf.Cpt.paging.resultsPerPageSlc.selectedIndex, this.duration);
- }
- }, {
- key: 'getPageLength',
-
- /**
- * Retrieve page length from cookie
- * @param {String} cookie name
- * @return {String}
- */
- value: function getPageLength(name) {
- return _cookie.Cookie.read(name);
- }
- }]);
-
- return Store;
- })();
-
- exports.Store = Store;
-});
-//# sourceMappingURL=store.js.map
\ No newline at end of file
diff --git a/dev/sort.js b/dev/sort.js
deleted file mode 100644
index b876320b..00000000
--- a/dev/sort.js
+++ /dev/null
@@ -1,17 +0,0 @@
-define(['exports', './string'], function (exports, _string) {
- 'use strict';
-
- var Sort = {
- ignoreCase: function ignoreCase(a, b) {
- var x = _string.Str.lower(a);
- var y = _string.Str.lower(b);
- return x < y ? -1 : x > y ? 1 : 0;
- }
- };
-
- exports.Sort = Sort;
-});
-/**
- * Sort helpers
- */
-//# sourceMappingURL=sort.js.map
\ No newline at end of file
diff --git a/dev/string.js b/dev/string.js
deleted file mode 100644
index 97b2e00e..00000000
--- a/dev/string.js
+++ /dev/null
@@ -1,51 +0,0 @@
-define(['exports'], function (exports) {
- /**
- * String utilities
- */
-
- 'use strict';
-
- var Str = {};
-
- Str.lower = function (text) {
- return text.toLowerCase();
- };
-
- Str.upper = function (text) {
- return text.toUpperCase();
- };
-
- Str.trim = function (text) {
- if (text.trim) {
- return text.trim();
- }
- return text.replace(/^\s*|\s*$/g, '');
- };
-
- Str.isEmpty = function (text) {
- return this.trim(text) === '';
- };
-
- Str.rgxEsc = function (text) {
- function escape(e) {
- var a = new RegExp('\\' + e, 'g');
- text = text.replace(a, '\\' + e);
- }
-
- var chars = ['\\', '[', '^', '$', '.', '|', '?', '*', '+', '(', ')'];
- for (var e = 0; e < chars.length; e++) {
- escape(chars[e]);
- }
- return text;
- };
-
- Str.matchCase = function (text, mc) {
- if (!mc) {
- return this.lower(text);
- }
- return text;
- };
-
- exports.Str = Str;
-});
-//# sourceMappingURL=string.js.map
\ No newline at end of file
diff --git a/dev/tablefilter.js b/dev/tablefilter.js
deleted file mode 100644
index 517caee4..00000000
--- a/dev/tablefilter.js
+++ /dev/null
@@ -1,3448 +0,0 @@
-define(['exports', './event', './dom', './string', './cookie', './types', './array', './helpers', './date', './sort', './modules/store', './modules/gridLayout', './modules/loader', './modules/highlightKeywords', './modules/popupFilter', './modules/dropdown', './modules/checkList', './modules/rowsCounter', './modules/statusBar', './modules/paging', './modules/clearButton', './modules/help', './modules/alternateRows', './modules/colOps'], function (exports, _event, _dom, _string, _cookie, _types, _array, _helpers, _date, _sort, _modulesStore, _modulesGridLayout, _modulesLoader, _modulesHighlightKeywords, _modulesPopupFilter, _modulesDropdown, _modulesCheckList, _modulesRowsCounter, _modulesStatusBar, _modulesPaging, _modulesClearButton, _modulesHelp, _modulesAlternateRows, _modulesColOps) {
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var global = window,
- isValidDate = _date.DateHelper.isValid,
- formatDate = _date.DateHelper.format,
- doc = global.document;
-
- var TableFilter = (function () {
-
- /**
- * TF object constructor
- * @param {String} id Table id
- * @param {Number} row index indicating the 1st row
- * @param {Object} configuration object
- */
-
- function TableFilter(id) {
- _classCallCheck(this, TableFilter);
-
- if (arguments.length === 0) {
- return;
- }
-
- this.id = id;
- this.version = '3.0';
- this.year = new Date().getFullYear();
- this.tbl = _dom.Dom.id(id);
- this.startRow = null;
- this.refRow = null;
- this.headersRow = null;
- this.cfg = {};
- this.nbFilterableRows = null;
- this.nbRows = null;
- this.nbCells = null;
- this._hasGrid = false;
- this.enableModules = false;
-
- if (!this.tbl || _string.Str.lower(this.tbl.nodeName) !== 'table' || this.getRowsNb() === 0) {
- throw new Error('Could not instantiate TableFilter class: ' + 'HTML table not found.');
- }
-
- if (arguments.length > 1) {
- for (var i = 0; i < arguments.length; i++) {
- var arg = arguments[i];
- var argtype = typeof arg;
- switch (_string.Str.lower(argtype)) {
- case 'number':
- this.startRow = arg;
- break;
- case 'object':
- this.cfg = arg;
- break;
- }
- }
- }
-
- // configuration object
- var f = this.cfg;
-
- //Start row et cols nb
- this.refRow = this.startRow === null ? 2 : this.startRow + 1;
- try {
- this.nbCells = this.getCellsNb(this.refRow);
- } catch (e) {
- this.nbCells = this.getCellsNb(0);
- }
-
- //default script base path
- this.basePath = f.base_path !== undefined ? f.base_path : '';
- this.extensionsPath = f.extensions_path || this.basePath + 'extensions/';
-
- /*** filter types ***/
- this.fltTypeInp = 'input';
- this.fltTypeSlc = 'select';
- this.fltTypeMulti = 'multiple';
- this.fltTypeCheckList = 'checklist';
- this.fltTypeNone = 'none';
- this.fltCol = []; //filter type of each column
-
- for (var j = 0; j < this.nbCells; j++) {
- var cfgCol = f['col_' + j];
- var col = !cfgCol ? this.fltTypeInp : _string.Str.lower(cfgCol);
- this.fltCol.push(col);
- this['col' + j] = col;
- }
-
- /*** Developer's additional methods ***/
- this.publicMethods = f.public_methods !== undefined ? f.public_methods : false;
-
- /*** filters' grid properties ***/
-
- //enables/disables filter grid
- this.fltGrid = f.grid === false ? false : true;
-
- /*** Grid layout ***/
- //enables/disables grid layout (fixed headers)
- this.gridLayout = f.grid_layout ? true : false;
- this.sourceTblHtml = null;
- if (this.gridLayout) {
- //Firefox does not support outerHTML property...
- if (this.tbl.outerHTML === undefined) {
- setOuterHtml();
- }
- this.sourceTblHtml = this.tbl.outerHTML;
- }
- /*** ***/
-
- this.filtersRowIndex = f.filters_row_index || 0;
- this.headersRow = f.headers_row_index || (this.filtersRowIndex === 0 ? 1 : 0);
-
- if (this.gridLayout) {
- if (this.headersRow > 1) {
- this.filtersRowIndex = this.headersRow + 1;
- } else {
- this.filtersRowIndex = 1;
- this.headersRow = 0;
- }
- }
-
- //defines tag of the cells containing filters (td/th)
- this.fltCellTag = f.filters_cell_tag !== 'th' || f.filters_cell_tag !== 'td' ? 'td' : f.filters_cell_tag;
-
- //stores filters ids
- this.fltIds = [];
- //stores filters DOM elements
- this.fltElms = [];
- //stores filters values
- this.searchArgs = null;
- //stores table data
- this.tblData = [];
- //stores valid rows indexes (rows visible upon filtering)
- this.validRowsIndex = null;
- //stores filters row element
- this.fltGridEl = null;
- //is first load boolean
- this.isFirstLoad = true;
- //container div for paging elements, reset btn etc.
- this.infDiv = null;
- //div for rows counter
- this.lDiv = null;
- //div for reset button and results per page select
- this.rDiv = null;
- //div for paging elements
- this.mDiv = null;
- //table container div for fixed headers (IE only)
- this.contDiv = null;
-
- //defines css class for div containing paging elements, rows counter etc.
- this.infDivCssClass = f.inf_div_css_class || 'inf';
- //defines css class for left div
- this.lDivCssClass = f.left_div_css_class || 'ldiv';
- //defines css class for right div
- this.rDivCssClass = f.right_div_css_class || 'rdiv';
- //defines css class for mid div
- this.mDivCssClass = f.middle_div_css_class || 'mdiv';
- //table container div css class
- this.contDivCssClass = f.content_div_css_class || 'cont';
-
- /*** filters' grid appearance ***/
- //stylesheet file
- this.stylesheet = f.stylesheet || this.basePath + 'filtergrid.css';
- this.stylesheetId = this.id + '_style';
- //defines css class for filters row
- this.fltsRowCssClass = f.flts_row_css_class || 'fltrow';
- //enables/disables icons (paging, reset button)
- this.enableIcons = f.enable_icons === false ? false : true;
- //enables/disbles rows alternating bg colors
- this.alternateBgs = f.alternate_rows === true ? true : false;
- //defines widths of columns
- this.hasColWidth = f.col_width === true ? true : false;
- this.colWidth = this.hasColWidth ? f.col_width : null;
- //enables/disables fixed headers
- this.fixedHeaders = f.fixed_headers === true ? true : false;
- //tbody height if fixed headers enabled
- this.tBodyH = !isNaN(f.tbody_height) ? f.tbody_height : 200;
- //defines css class for filters
- this.fltCssClass = f.flt_css_class || 'flt';
- //defines css class for multiple selects filters
- this.fltMultiCssClass = f.flt_multi_css_class || 'flt_multi';
- //defines css class for filters
- this.fltSmallCssClass = f.flt_small_css_class || 'flt_s';
- //defines css class for single-filter
- this.singleFltCssClass = f.single_flt_css_class || 'single_flt';
- this.isStartBgAlternate = true;
-
- /*** filters' grid behaviours ***/
- //enables/disables enter key
- this.enterKey = f.enter_key === false ? false : true;
- //enables/disables alternative fn call
- this.isModFilterFn = f.mod_filter_fn === true ? true : false;
- // used by tf_DetectKey fn
- this.modFilterFn = this.isModFilterFn ? f.mod_filter_fn : null;
- //calls function before filtering starts
- this.onBeforeFilter = _types.Types.isFn(f.on_before_filter) ? f.on_before_filter : null;
- //calls function after filtering
- this.onAfterFilter = _types.Types.isFn(f.on_after_filter) ? f.on_after_filter : null;
- //enables/disables case sensitivity
- this.matchCase = f.match_case === true ? true : false;
- //enables/disbles exact match for search
- this.exactMatch = f.exact_match === true ? true : false;
- //refreshes drop-down lists upon validation
- this.linkedFilters = f.linked_filters === true ? true : false;
- //wheter excluded options are disabled
- this.disableExcludedOptions = f.disable_excluded_options === true ? true : false;
- //stores active filter element
- this.activeFlt = null;
- //id of active filter
- this.activeFilterId = null;
- //enables/disbles column operation(sum,mean)
- this.hasColOperation = f.col_operation ? true : false;
- this.colOperation = null;
- //enables always visible rows
- this.hasVisibleRows = f.rows_always_visible ? true : false;
- //array containing always visible rows
- this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : [];
- //defines search type: include or exclude
- this.searchType = f.search_type || 'include';
- //enables/disables external filters generation
- this.isExternalFlt = f.external_flt_grid === true ? true : false;
- //array containing ids of external elements containing filters
- this.externalFltTgtIds = f.external_flt_grid_ids || null;
- //stores filters elements if isExternalFlt is true
- this.externalFltEls = [];
- //delays any filtering process if loader true
- this.execDelay = !isNaN(f.exec_delay) ? parseInt(f.exec_delay, 10) : 100;
- //calls function when filters grid loaded
- this.onFiltersLoaded = _types.Types.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null;
- //enables/disables single filter search
- this.singleSearchFlt = f.single_search_filter === true ? true : false;
- //calls function after row is validated
- this.onRowValidated = _types.Types.isFn(f.on_row_validated) ? f.on_row_validated : null;
- //array defining columns for customCellData event
- this.customCellDataCols = f.custom_cell_data_cols ? f.custom_cell_data_cols : [];
- //calls custom function for retrieving cell data
- this.customCellData = _types.Types.isFn(f.custom_cell_data) ? f.custom_cell_data : null;
- //input watermark text array
- this.watermark = f.watermark || '';
- this.isWatermarkArray = _types.Types.isArray(this.watermark);
- //id of toolbar container element
- this.toolBarTgtId = f.toolbar_target_id || null;
- //enables/disables help div
- this.helpInstructions = f.help_instructions || false;
- //popup filters
- this.popUpFilters = f.popup_filters === true ? true : false;
- //active columns color
- this.markActiveColumns = f.mark_active_columns === true ? true : false;
- //defines css class for active column header
- this.activeColumnsCssClass = f.active_columns_css_class || 'activeHeader';
- //calls function before active column header is marked
- this.onBeforeActiveColumn = _types.Types.isFn(f.on_before_active_column) ? f.on_before_active_column : null;
- //calls function after active column header is marked
- this.onAfterActiveColumn = _types.Types.isFn(f.on_after_active_column) ? f.on_after_active_column : null;
-
- /*** select filter's customisation and behaviours ***/
- //defines 1st option text
- this.displayAllText = f.display_all_text || '';
- //enables/disables empty option in combo-box filters
- this.enableEmptyOption = f.enable_empty_option === true ? true : false;
- //defines empty option text
- this.emptyText = f.empty_text || '(Empty)';
- //enables/disables non empty option in combo-box filters
- this.enableNonEmptyOption = f.enable_non_empty_option === true ? true : false;
- //defines empty option text
- this.nonEmptyText = f.non_empty_text || '(Non empty)';
- //enables/disables onChange event on combo-box
- this.onSlcChange = f.on_change === false ? false : true;
- //enables/disables select options sorting
- this.sortSlc = f.sort_select === false ? false : true;
- //enables/disables ascending numeric options sorting
- this.isSortNumAsc = f.sort_num_asc === true ? true : false;
- this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null;
- //enables/disables descending numeric options sorting
- this.isSortNumDesc = f.sort_num_desc === true ? true : false;
- this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null;
- //enabled selects are populated on demand
- this.fillSlcOnDemand = f.fill_slc_on_demand === true ? true : false;
- this.hasCustomSlcOptions = _types.Types.isObj(f.custom_slc_options) ? true : false;
- this.customSlcOptions = _types.Types.isArray(f.custom_slc_options) ? f.custom_slc_options : null;
-
- /*** Filter operators ***/
- this.rgxOperator = f.regexp_operator || 'rgx:';
- this.emOperator = f.empty_operator || '[empty]';
- this.nmOperator = f.nonempty_operator || '[nonempty]';
- this.orOperator = f.or_operator || '||';
- this.anOperator = f.and_operator || '&&';
- this.grOperator = f.greater_operator || '>';
- this.lwOperator = f.lower_operator || '<';
- this.leOperator = f.lower_equal_operator || '<=';
- this.geOperator = f.greater_equal_operator || '>=';
- this.dfOperator = f.different_operator || '!';
- this.lkOperator = f.like_operator || '*';
- this.eqOperator = f.equal_operator || '=';
- this.stOperator = f.start_with_operator || '{';
- this.enOperator = f.end_with_operator || '}';
- this.curExp = f.cur_exp || '^[¥£€$]';
- this.separator = f.separator || ',';
-
- /*** rows counter ***/
- //show/hides rows counter
- this.rowsCounter = f.rows_counter === true ? true : false;
-
- /*** status bar ***/
- //show/hides status bar
- this.statusBar = f.status_bar === true ? true : false;
-
- /*** loader ***/
- //enables/disables loader/spinner indicator
- this.loader = f.loader === true ? true : false;
-
- /*** validation - reset buttons/links ***/
- //show/hides filter's validation button
- this.displayBtn = f.btn === true ? true : false;
- //defines validation button text
- this.btnText = f.btn_text || (!this.enableIcons ? 'Go' : '');
- //defines css class for validation button
- this.btnCssClass = f.btn_css_class || (!this.enableIcons ? 'btnflt' : 'btnflt_icon');
- //show/hides reset link
- this.btnReset = f.btn_reset === true ? true : false;
- //defines css class for reset button
- this.btnResetCssClass = f.btn_reset_css_class || 'reset';
- //callback function before filters are cleared
- this.onBeforeReset = _types.Types.isFn(f.on_before_reset) ? f.on_before_reset : null;
- //callback function after filters are cleared
- this.onAfterReset = _types.Types.isFn(f.on_after_reset) ? f.on_after_reset : null;
-
- /*** paging ***/
- //enables/disables table paging
- this.paging = f.paging === true ? true : false;
- this.nbVisibleRows = 0; //nb visible rows
- this.nbHiddenRows = 0; //nb hidden rows
-
- /*** webfx sort adapter ***/
- //enables/disables default table sorting
- this.sort = f.sort === true ? true : false;
- //indicates if sort is set (used in tfAdapter.sortabletable.js)
- this.isSortEnabled = false;
- this.sortConfig = f.sort_config || {};
- this.sortConfig.name = this.sortConfig.name !== undefined ? f.sort_config.name : 'sortabletable';
- this.sortConfig.src = this.sortConfig.src !== undefined ? f.sort_config.src : this.extensionsPath + 'sortabletable/' + 'sortabletable.js';
- this.sortConfig.adapterSrc = this.sortConfig.adapter_src !== undefined ? f.sort_config.adapter_src : this.extensionsPath + 'sortabletable/adapterSortabletable.js';
- this.sortConfig.initialize = this.sortConfig.initialize !== undefined ? f.sort_config.initialize : function (o) {};
- this.sortConfig.sortTypes = _types.Types.isArray(this.sortConfig.sort_types) ? f.sort_config.sort_types : [];
- this.sortConfig.sortCol = this.sortConfig.sort_col !== undefined ? f.sort_config.sort_col : null;
- this.sortConfig.asyncSort = this.sortConfig.async_sort === true ? true : false;
- this.sortConfig.triggerIds = _types.Types.isArray(this.sortConfig.sort_trigger_ids) ? f.sort_config.sort_trigger_ids : [];
-
- /*** ezEditTable extension ***/
- //enables/disables table selection feature
- this.selectable = f.selectable === true ? true : false;
- //enables/disables editable table feature
- this.editable = f.editable === true ? true : false;
- this.ezEditTableConfig = f.ezEditTable_config || {};
- this.ezEditTableConfig.name = this.ezEditTableConfig.name !== undefined ? f.ezEditTable_config.name : 'ezedittable';
- this.ezEditTableConfig.src = this.ezEditTableConfig.src !== undefined ? f.ezEditTable_config.src : this.extensionsPath + 'ezEditTable/ezEditTable.js';
- //ezEditTable stylesheet not imported by default as filtergrid.css
- //applies
- this.ezEditTableConfig.loadStylesheet = this.ezEditTableConfig.loadStylesheet === true ? true : false;
- this.ezEditTableConfig.stylesheet = this.ezEditTableConfig.stylesheet || this.extensionsPath + 'ezEditTable/ezEditTable.css';
- this.ezEditTableConfig.stylesheetName = this.ezEditTableConfig.stylesheetName !== undefined ? f.ezEditTable_config.stylesheetName : 'ezEditTableCss';
- this.ezEditTableConfig.err = 'Failed to instantiate EditTable ' + 'object.\n"ezEditTable" module may not be available.';
-
- /*** onkeyup event ***/
- //enables/disables onkeyup event, table is filtered when user stops
- //typing
- this.onKeyUp = f.on_keyup === true ? true : false;
- //onkeyup delay timer (msecs)
- this.onKeyUpDelay = !isNaN(f.on_keyup_delay) ? f.on_keyup_delay : 900;
- this.isUserTyping = null; //typing indicator
- this.onKeyUpTimer = undefined;
-
- /*** keyword highlighting ***/
- //enables/disables keyword highlighting
- this.highlightKeywords = f.highlight_keywords === true ? true : false;
-
- /*** data types ***/
- //defines default date type (european DMY)
- this.defaultDateType = f.default_date_type || 'DMY';
- //defines default thousands separator
- //US = ',' EU = '.'
- this.thousandsSeparator = f.thousands_separator || ',';
- //defines default decimal separator
- //US & javascript = '.' EU = ','
- this.decimalSeparator = f.decimal_separator || '.';
- //enables number format per column
- this.hasColNbFormat = f.col_number_format === true ? true : false;
- //array containing columns nb formats
- this.colNbFormat = _types.Types.isArray(this.hasColNbFormat) ? f.col_number_format : null;
- //enables date type per column
- this.hasColDateType = f.col_date_type === true ? true : false;
- //array containing columns date type
- this.colDateType = _types.Types.isArray(this.hasColDateType) ? f.col_date_type : null;
-
- /*** status messages ***/
- //filtering
- this.msgFilter = f.msg_filter || 'Filtering data...';
- //populating drop-downs
- this.msgPopulate = f.msg_populate || 'Populating filter...';
- //populating drop-downs
- this.msgPopulateCheckList = f.msg_populate_checklist || 'Populating list...';
- //changing paging page
- this.msgChangePage = f.msg_change_page || 'Collecting paging data...';
- //clearing filters
- this.msgClear = f.msg_clear || 'Clearing filters...';
- //changing nb results/page
- this.msgChangeResults = f.msg_change_results || 'Changing results per page...';
- //re-setting grid values
- this.msgResetValues = f.msg_reset_grid_values || 'Re-setting filters values...';
- //re-setting page
- this.msgResetPage = f.msg_reset_page || 'Re-setting page...';
- //re-setting page length
- this.msgResetPageLength = f.msg_reset_page_length || 'Re-setting page length...';
- //table sorting
- this.msgSort = f.msg_sort || 'Sorting data...';
- //extensions loading
- this.msgLoadExtensions = f.msg_load_extensions || 'Loading extensions...';
- //themes loading
- this.msgLoadThemes = f.msg_load_themes || 'Loading theme(s)...';
-
- /*** ids prefixes ***/
- //css class name added to table
- this.prfxTf = 'TF';
- //filters (inputs - selects)
- this.prfxFlt = 'flt';
- //validation button
- this.prfxValButton = 'btn';
- //container div for paging elements, rows counter etc.
- this.prfxInfDiv = 'inf_';
- //left div
- this.prfxLDiv = 'ldiv_';
- //right div
- this.prfxRDiv = 'rdiv_';
- //middle div
- this.prfxMDiv = 'mdiv_';
- //filter values cookie
- this.prfxCookieFltsValues = 'tf_flts_';
- //page nb cookie
- this.prfxCookiePageNb = 'tf_pgnb_';
- //page length cookie
- this.prfxCookiePageLen = 'tf_pglen_';
-
- /*** cookies ***/
- this.hasStoredValues = false;
- //remembers filters values on page load
- this.rememberGridValues = f.remember_grid_values === true ? true : false;
- //cookie storing filter values
- this.fltsValuesCookie = this.prfxCookieFltsValues + this.id;
- //remembers page nb on page load
- this.rememberPageNb = this.paging && f.remember_page_number ? true : false;
- //cookie storing page nb
- this.pgNbCookie = this.prfxCookiePageNb + this.id;
- //remembers page length on page load
- this.rememberPageLen = this.paging && f.remember_page_length ? true : false;
- //cookie storing page length
- this.pgLenCookie = this.prfxCookiePageLen + this.id;
-
- /*** extensions ***/
- //imports external script
- // this.hasExtensions = f.extensions===true ? true : false;
- // this.extensions = this.hasExtensions ? f.extensions : null;
- this.extensions = f.extensions;
- this.hasExtensions = _types.Types.isArray(this.extensions);
-
- /*** themes ***/
- this.enableDefaultTheme = f.enable_default_theme === true ? true : false;
- //imports themes
- this.hasThemes = f.enable_default_theme || f.themes && _types.Types.isObj(f.themes) ? true : false;
- this.themes = this.hasThemes ? f.themes : null;
- //themes path
- this.themesPath = f.themes_path || this.basePath + 'TF_Themes/';
-
- // Features registry
- this.Cpt = {
- loader: null,
- alternateRows: null,
- colOps: null,
- rowsCounter: null,
- gridLayout: null,
- store: null,
- highlightKeywords: null,
- paging: null,
- checkList: null,
- dropdown: null,
- popupFilter: null,
- clearButton: null,
- help: null,
- statusBar: null
- };
-
- // Extensions registry
- this.ExtRegistry = {
- sort: null,
- ezEditTable: null
- };
-
- /*** TF events ***/
- var o = this;
- this.Evt = {
- name: {
- filter: 'Filter',
- dropdown: 'dropdown',
- checklist: 'checkList',
- changepage: 'changePage',
- clear: 'Clear',
- changeresultsperpage: 'changeResults',
- resetvalues: 'ResetValues',
- resetpage: 'resetPage',
- resetpagelength: 'resetPageLength',
- sort: 'Sort',
- loadextensions: 'LoadExtensions',
- loadthemes: 'loadThemes'
- },
-
- /*====================================================
- - Detects key for a given element
- =====================================================*/
- detectKey: function detectKey(e) {
- if (!o.enterKey) {
- return;
- }
- var _evt = e || global.event;
- if (_evt) {
- var key = _event.Event.keyCode(_evt);
- if (key === 13) {
- o._filter();
- _event.Event.cancel(_evt);
- _event.Event.stop(_evt);
- } else {
- o.isUserTyping = true;
- global.clearInterval(o.onKeyUpTimer);
- o.onKeyUpTimer = undefined;
- }
- } //if evt
- },
- /*====================================================
- - onkeyup event for text filters
- =====================================================*/
- onKeyUp: function onKeyUp(e) {
- if (!o.onKeyUp) {
- return;
- }
- var _evt = e || global.event;
- var key = _event.Event.keyCode(_evt);
- o.isUserTyping = false;
-
- function filter() {
- global.clearInterval(o.onKeyUpTimer);
- o.onKeyUpTimer = undefined;
- if (!o.isUserTyping) {
- o.filter();
- o.isUserTyping = null;
- }
- }
-
- if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) {
- if (o.onKeyUpTimer === undefined) {
- o.onKeyUpTimer = global.setInterval(filter, o.onKeyUpDelay);
- }
- } else {
- global.clearInterval(o.onKeyUpTimer);
- o.onKeyUpTimer = undefined;
- }
- },
- /*====================================================
- - onkeydown event for input filters
- =====================================================*/
- onKeyDown: function onKeyDown(e) {
- if (!o.onKeyUp) {
- return;
- }
- o.isUserTyping = true;
- },
- /*====================================================
- - onblur event for input filters
- =====================================================*/
- onInpBlur: function onInpBlur(e) {
- if (o.onKeyUp) {
- o.isUserTyping = false;
- global.clearInterval(o.onKeyUpTimer);
- }
- if (o.ezEditTable) {
- if (o.editable) {
- o.ezEditTable.Editable.Set();
- }
- if (o.selectable) {
- o.ezEditTable.Selection.Set();
- }
- }
- },
- /*====================================================
- - onfocus event for input filters
- =====================================================*/
- onInpFocus: function onInpFocus(e) {
- var _evt = e || global.event;
- o.activeFilterId = this.getAttribute('id');
- o.activeFlt = _dom.Dom.id(o.activeFilterId);
- if (o.popUpFilters) {
- _event.Event.cancel(_evt);
- _event.Event.stop(_evt);
- }
- if (o.ezEditTable) {
- if (o.editable) {
- o.ezEditTable.Editable.Remove();
- }
- if (o.selectable) {
- o.ezEditTable.Selection.Remove();
- }
- }
- },
- /*====================================================
- - onfocus event for select filters
- =====================================================*/
- onSlcFocus: function onSlcFocus(e) {
- var _evt = e || global.event;
- o.activeFilterId = this.getAttribute('id');
- o.activeFlt = _dom.Dom.id(o.activeFilterId);
- // select is populated when element has focus
- if (o.fillSlcOnDemand && this.getAttribute('filled') === '0') {
- var ct = this.getAttribute('ct');
- o.Cpt.dropdown._build(ct);
- }
- if (o.popUpFilters) {
- _event.Event.cancel(_evt);
- _event.Event.stop(_evt);
- }
- },
- /*====================================================
- - onchange event for select filters
- =====================================================*/
- onSlcChange: function onSlcChange(e) {
- if (!o.activeFlt) {
- return;
- }
- var colIndex = o.activeFlt.getAttribute('colIndex');
- //Checks filter is a checklist and caller is not null
- // if(o.activeFlt && colIndex &&
- // o['col'+colIndex]===o.fltTypeCheckList &&
- // !o.Evt.onSlcChange.caller){ return; }
- var _evt = e || global.event;
- if (o.popUpFilters) {
- _event.Event.stop(_evt);
- }
- if (o.onSlcChange) {
- o.filter();
- }
- },
- /*====================================================
- - onblur event for select filters
- =====================================================*/
- // _OnSlcBlur: function(e) {},
- /*====================================================
- - onclick event for checklist filters
- =====================================================*/
- onCheckListClick: function onCheckListClick() {
- if (o.fillSlcOnDemand && this.getAttribute('filled') === '0') {
- var ct = this.getAttribute('ct');
- o.Cpt.checkList._build(ct);
- o.Cpt.checkList.checkListDiv[ct].onclick = null;
- o.Cpt.checkList.checkListDiv[ct].title = '';
- }
- },
- /*====================================================
- - onclick event for checklist filter container
- =====================================================*/
- onCheckListFocus: function onCheckListFocus(e) {
- o.activeFilterId = this.firstChild.getAttribute('id');
- o.activeFlt = _dom.Dom.id(o.activeFilterId);
- },
- /*====================================================
- - onclick event for validation button
- (btn property)
- =====================================================*/
- onBtnClick: function onBtnClick() {
- o.filter();
- }
- // ,
- // _OnSlcPagesChangeEvt: null, //used by sort adapter
- /*====================================================
- - onclick event slc parent node (enables filters)
- IE only
- =====================================================*/
- // _EnableSlc: function() {
- // this.firstChild.disabled = false;
- // this.firstChild.focus();
- // this.onclick = null;
- // },
-
- // _Paging: { //used by sort adapter
- // nextEvt: null,
- // prevEvt: null,
- // lastEvt: null,
- // firstEvt: null
- // }
- };
- }
-
- _createClass(TableFilter, [{
- key: 'init',
-
- /*====================================================
- - initialises filtering grid bar behaviours and
- layout
- =====================================================*/
- value: function init() {
- if (this._hasGrid) {
- return;
- }
- if (!this.tbl) {
- this.tbl = _dom.Dom.id(this.id);
- }
- if (this.gridLayout) {
- this.refRow = this.startRow === null ? 0 : this.startRow;
- }
- if (this.popUpFilters && (this.filtersRowIndex === 0 && this.headersRow === 1 || this.gridLayout)) {
- this.headersRow = 0;
- }
- var f = this.cfg,
- n = this.singleSearchFlt ? 1 : this.nbCells,
- inpclass;
-
- if (window['tf_' + this.id] === undefined) {
- window['tf_' + this.id] = this;
- }
-
- //loads stylesheet if not imported
- //Issues with browsers != IE, IE rules in this case
- this.includeFile(this.stylesheetId, this.stylesheet, null, 'link');
-
- //loads theme
- if (this.hasThemes) {
- this._loadThemes();
- }
-
- if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) {
- //var Store = require('modules/store').Store;
- // import {Store} from 'modules/store';
- this.Cpt.store = new _modulesStore.Store(this);
- }
-
- if (this.gridLayout) {
- // var GridLayout = require('modules/gridLayout').GridLayout;
- // import {GridLayout} from 'modules/gridLayout';
- this.Cpt.gridLayout = new _modulesGridLayout.GridLayout(this);
- this.Cpt.gridLayout.init();
- }
-
- if (this.loader) {
- if (!this.Cpt.loader) {
- // var Loader = require('modules/loader').Loader;
- // import {Loader} from 'modules/loader';
- this.Cpt.loader = new _modulesLoader.Loader(this);
- }
- }
-
- if (this.highlightKeywords) {
- // var Highlight =
- // require('modules/highlightKeywords').HighlightKeyword;
- // import {HighlightKeyword} from 'modules/highlightKeywords';
- this.Cpt.highlightKeyword = new _modulesHighlightKeywords.HighlightKeyword(this);
- }
-
- if (this.popUpFilters) {
- if (!this.Cpt.popupFilter) {
- // var PopupFilter = require('modules/popupFilter').PopupFilter;
- // import {PopupFilter} from 'modules/popupFilter';
- this.Cpt.popupFilter = new _modulesPopupFilter.PopupFilter(this);
- }
- this.Cpt.popupFilter.init();
- }
-
- //filters grid is not generated
- if (!this.fltGrid) {
- this.refRow = this.refRow - 1;
- if (this.gridLayout) {
- this.refRow = 0;
- }
- this.nbFilterableRows = this.getRowsNb();
- this.nbVisibleRows = this.nbFilterableRows;
- this.nbRows = this.nbFilterableRows + this.refRow;
- } else {
- if (this.isFirstLoad) {
- var fltrow;
- if (!this.gridLayout) {
- var thead = _dom.Dom.tag(this.tbl, 'thead');
- if (thead.length > 0) {
- fltrow = thead[0].insertRow(this.filtersRowIndex);
- } else {
- fltrow = this.tbl.insertRow(this.filtersRowIndex);
- }
-
- if (this.headersRow > 1 && this.filtersRowIndex <= this.headersRow && !this.popUpFilters) {
- this.headersRow++;
- }
- if (this.popUpFilters) {
- this.headersRow++;
- }
-
- fltrow.className = this.fltsRowCssClass;
- //Disable for grid_layout
- if (this.isExternalFlt && (!this.gridLayout || this.popUpFilters)) {
- fltrow.style.display = 'none';
- }
- }
-
- this.nbFilterableRows = this.getRowsNb();
- this.nbVisibleRows = this.nbFilterableRows;
- this.nbRows = this.tbl.rows.length;
-
- for (var i = 0; i < n; i++) {
- // this loop adds filters
-
- if (this.popUpFilters) {
- this.Cpt.popupFilter.build(i);
- }
-
- var fltcell = _dom.Dom.create(this.fltCellTag),
- col = this['col' + i],
- externalFltTgtId = this.isExternalFlt && this.externalFltTgtIds ? this.externalFltTgtIds[i] : null;
-
- if (this.singleSearchFlt) {
- fltcell.colSpan = this.nbCells;
- }
- if (!this.gridLayout) {
- fltrow.appendChild(fltcell);
- }
- inpclass = i == n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass;
-
- if (col === undefined) {
- col = f['col_' + i] === undefined ? this.fltTypeInp : _string.Str.lower(f['col_' + i]);
- }
-
- //only 1 input for single search
- if (this.singleSearchFlt) {
- col = this.fltTypeInp;
- inpclass = this.singleFltCssClass;
- }
-
- //drop-down filters
- if (col === this.fltTypeSlc || col === this.fltTypeMulti) {
- if (!this.Cpt.dropdown) {
- // var Dropdown = require('modules/dropdown').Dropdown;
- // import {Dropdown} from 'modules/dropdown';
- this.Cpt.dropdown = new _modulesDropdown.Dropdown(this);
- }
- var dropdown = this.Cpt.dropdown;
-
- var slc = _dom.Dom.create(this.fltTypeSlc, ['id', this.prfxFlt + i + '_' + this.id], ['ct', i], ['filled', '0']);
-
- if (col === this.fltTypeMulti) {
- slc.multiple = this.fltTypeMulti;
- slc.title = dropdown.multipleSlcTooltip;
- }
- slc.className = _string.Str.lower(col) === this.fltTypeSlc ? inpclass : this.fltMultiCssClass; // for ie<=6
-
- //filter is appended in desired external element
- if (externalFltTgtId) {
- _dom.Dom.id(externalFltTgtId).appendChild(slc);
- this.externalFltEls.push(slc);
- } else {
- fltcell.appendChild(slc);
- }
-
- this.fltIds.push(this.prfxFlt + i + '_' + this.id);
-
- if (!this.fillSlcOnDemand) {
- dropdown._build(i);
- }
-
- _event.Event.add(slc, 'keypress', this.Evt.detectKey);
- _event.Event.add(slc, 'change', this.Evt.onSlcChange);
- _event.Event.add(slc, 'focus', this.Evt.onSlcFocus);
- // evt.add(slc, 'blur', this.Evt._OnSlcBlur);
-
- //1st option is created here since dropdown.build isn't
- //invoked
- if (this.fillSlcOnDemand) {
- var opt0 = _dom.Dom.createOpt(this.displayAllText, '');
- slc.appendChild(opt0);
- }
- }
- // checklist
- else if (col === this.fltTypeCheckList) {
- var checkList;
- if (!this.Cpt.checkList) {
- // var CheckList =
- // require('modules/checkList').CheckList;
- // import {CheckList} from 'modules/checkList';
- this.Cpt.checkList = new _modulesCheckList.CheckList(this);
- checkList = this.Cpt.checkList;
- }
-
- var divCont = _dom.Dom.create('div', ['id', checkList.prfxCheckListDiv + i + '_' + this.id], ['ct', i], ['filled', '0']);
- divCont.className = checkList.checkListDivCssClass;
-
- //filter is appended in desired element
- if (externalFltTgtId) {
- _dom.Dom.id(externalFltTgtId).appendChild(divCont);
- this.externalFltEls.push(divCont);
- } else {
- fltcell.appendChild(divCont);
- }
-
- checkList.checkListDiv[i] = divCont;
- this.fltIds.push(this.prfxFlt + i + '_' + this.id);
- if (!this.fillSlcOnDemand) {
- checkList._build(i);
- }
-
- if (this.fillSlcOnDemand) {
- _event.Event.add(divCont, 'click', this.Evt.onCheckListClick);
- divCont.appendChild(_dom.Dom.text(checkList.activateCheckListTxt));
- }
-
- _event.Event.add(divCont, 'click', this.Evt.onCheckListFocus);
- } else {
- //show/hide input
- var inptype = col === this.fltTypeInp ? 'text' : 'hidden';
- var inp = _dom.Dom.create(this.fltTypeInp, ['id', this.prfxFlt + i + '_' + this.id], ['type', inptype], ['ct', i]);
- if (inptype !== 'hidden' && this.watermark) {
- inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[i] || '' : this.watermark);
- }
- inp.className = inpclass;
- inp.onfocus = this.Evt.onInpFocus;
-
- //filter is appended in desired element
- if (externalFltTgtId) {
- _dom.Dom.id(externalFltTgtId).appendChild(inp);
- this.externalFltEls.push(inp);
- } else {
- fltcell.appendChild(inp);
- }
-
- this.fltIds.push(this.prfxFlt + i + '_' + this.id);
-
- inp.onkeypress = this.Evt.detectKey;
- inp.onkeydown = this.Evt.onKeyDown;
- inp.onkeyup = this.Evt.onKeyUp;
- inp.onblur = this.Evt.onInpBlur;
-
- if (this.rememberGridValues) {
- var flts_values = this.Cpt.store.getFilterValues(this.fltsValuesCookie);
- if (flts_values[i] != ' ') {
- this.setFilterValue(i, flts_values[i], false);
- }
- }
- }
- // this adds submit button
- if (i == n - 1 && this.displayBtn) {
- var btn = _dom.Dom.create(this.fltTypeInp, ['id', this.prfxValButton + i + '_' + this.id], ['type', 'button'], ['value', this.btnText]);
- btn.className = this.btnCssClass;
-
- //filter is appended in desired element
- if (externalFltTgtId) {
- _dom.Dom.id(externalFltTgtId).appendChild(btn);
- } else {
- fltcell.appendChild(btn);
- }
-
- btn.onclick = this.Evt.onBtnClick;
- } //if
- } // for i
- } else {
- this._resetGrid();
- } //if isFirstLoad
- } //if this.fltGrid
-
- /* Filter behaviours */
- if (this.rowsCounter) {
- // var RowsCounter = require('modules/rowsCounter').RowsCounter;
- // import {RowsCounter} from 'modules/rowsCounter';
- this.Cpt.rowsCounter = new _modulesRowsCounter.RowsCounter(this);
- this.Cpt.rowsCounter.init();
- }
- if (this.statusBar) {
- // var StatusBar = require('modules/statusBar').StatusBar;
- // import {StatusBar} from 'modules/statusBar';
- this.Cpt.statusBar = new _modulesStatusBar.StatusBar(this);
- this.Cpt.statusBar.init();
- }
- if (this.paging || this.Cpt.paging && this.Cpt.paging.isPagingRemoved) {
- // var Paging = require('modules/paging').Paging;
- // import {Paging} from 'modules/paging';
- // if(!this.Cpt.paging){
- this.Cpt.paging = new _modulesPaging.Paging(this);
- // }
- this.Cpt.paging.init();
- }
- if (this.btnReset) {
- // var ClearButton = require('modules/clearButton').ClearButton;
- // import {ClearButton} from 'modules/clearButton';
- this.Cpt.clearButton = new _modulesClearButton.ClearButton(this);
- this.Cpt.clearButton.init();
- }
- if (this.helpInstructions) {
- // var Help = require('modules/help').Help;
- // import {Help} from 'modules/help';
- this.Cpt.help = new _modulesHelp.Help(this);
- this.Cpt.help.init();
- }
- if (this.hasColWidth && !this.gridLayout) {
- this.setColWidths();
- }
- if (this.alternateBgs) {
- //1st time only if no paging and rememberGridValues
- // var AlternateRows = require('modules/alternateRows').AlternateRows;
- // import {AlternateRows} from 'modules/alternateRows';
- this.Cpt.alternateRows = new _modulesAlternateRows.AlternateRows(this);
- this.Cpt.alternateRows.init();
- }
- if (this.hasColOperation) {
- // var ColOps = require('modules/colOps').ColOps;
- // import {ColOps} from 'modules/colOps';
- this.Cpt.colOps = new _modulesColOps.ColOps(this);
- this.Cpt.colOps.calc();
- }
- if (this.sort /*|| this.gridLayout*/) {
- this.setSort();
- }
- if (this.selectable || this.editable) {
- this.setEditable();
- }
-
- this.isFirstLoad = false;
- this._hasGrid = true;
-
- if (this.rememberGridValues || this.rememberPageLen || this.rememberPageNb) {
- this.resetValues();
- }
-
- //TF css class is added to table
- if (!this.gridLayout) {
- _dom.Dom.addClass(this.tbl, this.prfxTf);
- }
-
- if (this.loader) {
- this.Cpt.loader.show('none');
- }
-
- /* Loads extensions */
- if (this.hasExtensions) {
- // this.loadExtensions();
- // this.registerExtensions();
- this.initExtensions();
- }
-
- if (this.onFiltersLoaded) {
- this.onFiltersLoaded.call(null, this);
- }
- }
- }, {
- key: 'EvtManager',
-
- /*====================================================
- - TF events manager
- - Params:
- - event name (string)
- - config object (optional literal object)
- =====================================================*/
- value: function EvtManager(evt, s) {
- var o = this;
- var slcIndex = s && s.slcIndex !== undefined ? s.slcIndex : null;
- var slcExternal = s && s.slcExternal !== undefined ? s.slcExternal : false;
- var slcId = s && s.slcId !== undefined ? s.slcId : null;
- var pgIndex = s && s.pgIndex !== undefined ? s.pgIndex : null;
-
- function efx() {
- if (!evt) {
- return;
- }
- switch (evt) {
- case o.Evt.name.filter:
- if (o.isModFilterFn) {
- o.modFilterFn.call(null, o);
- } else {
- o._filter();
- }
- break;
- case o.Evt.name.dropdown:
- if (o.linkedFilters) {
- o.Cpt.dropdown._build(slcIndex, true);
- } else {
- o.Cpt.dropdown._build(slcIndex, false, slcExternal, slcId);
- }
- break;
- case o.Evt.name.checklist:
- o.Cpt.checkList._build(slcIndex, slcExternal, slcId);
- break;
- case o.Evt.name.changepage:
- o.Cpt.paging._changePage(pgIndex);
- break;
- case o.Evt.name.clear:
- o._clearFilters();
- o._filter();
- break;
- case o.Evt.name.changeresultsperpage:
- o.Cpt.paging._changeResultsPerPage();
- break;
- case o.Evt.name.resetvalues:
- o._resetValues();
- o._filter();
- break;
- case o.Evt.name.resetpage:
- o.Cpt.paging._resetPage(o.pgNbCookie);
- break;
- case o.Evt.name.resetpagelength:
- o.Cpt.paging._resetPageLength(o.pgLenCookie);
- break;
- case o.Evt.name.sort:
- void 0;
- break;
- case o.Evt.name.loadextensions:
- o._loadExtensions();
- break;
- case o.Evt.name.loadthemes:
- o._loadThemes();
- break;
- default:
- //to be used by extensions events when needed
- o['_' + evt].call(null, o, s);
- break;
- }
- if (o.statusBar) {
- o.Cpt.statusBar.message('');
- }
- if (o.loader) {
- o.Cpt.loader.show('none');
- }
- }
-
- if (this.loader || this.statusBar) {
- try {
- this.Cpt.loader.show('');
- this.Cpt.statusBar.message(this['msg' + evt]);
- } catch (e) {}
- global.setTimeout(efx, this.execDelay);
- } else {
- efx();
- }
- }
- }, {
- key: 'initExtensions',
- value: function initExtensions() {
- var exts = this.extensions;
-
- for (var i = 0; i < exts.length; i++) {
- var ext = exts[i];
- if (_types.Types.isUndef(this.ExtRegistry[ext.name])) {
- this.loadExtension(ext);
- }
- }
- }
- }, {
- key: 'loadExtension',
- value: function loadExtension(ext) {
- var _this = this;
-
- if (!ext || !ext.name) {
- return;
- }
-
- var name = ext.name;
- var path = ext.path;
- var modulePath;
-
- if (name && path) {
- modulePath = ext.path + '/' + name;
- } else {
- name = name.replace('.js', '');
- modulePath = './extensions/{}/{}'.replace(/{}/g, name);
- }
-
- require([modulePath], function (mod) {
- var inst = new mod(_this, ext);
- inst.init();
- _this.ExtRegistry[name] = inst;
- });
- }
- }, {
- key: 'loadThemes',
- value: function loadThemes() {
- this.EvtManager(this.Evt.name.loadthemes);
- }
- }, {
- key: '_loadThemes',
-
- /*====================================================
- - loads TF themes
- =====================================================*/
- value: function _loadThemes() {
- if (!this.hasThemes) {
- return;
- }
- if (!this.Thm) {
- /*** TF themes ***/
- var o = this;
- this.Thm = {
- list: {},
- add: function add(thmName, thmDesc, thmPath, thmCallBack) {
- var file = thmPath.split('/')[thmPath.split('/').length - 1],
- re = new RegExp(file),
- path = thmPath.replace(re, '');
- o.Thm.list[thmName] = {
- name: thmName,
- description: thmDesc,
- file: file,
- path: path,
- callback: thmCallBack
- };
- }
- };
- }
-
- //Default theme config
- if (this.enableDefaultTheme) {
- this.themes = {
- name: ['DefaultTheme'],
- src: [this.themesPath + 'Default/TF_Default.css'],
- description: ['Default Theme']
- };
- this.Thm.add('DefaultTheme', this.themesPath + 'Default/TF_Default.css', 'Default Theme');
- }
- if (_types.Types.isArray(this.themes.name) && _types.Types.isArray(this.themes.src)) {
- var thm = this.themes;
- for (var i = 0; i < thm.name.length; i++) {
- var thmPath = thm.src[i],
- thmName = thm.name[i],
- thmInit = thm.initialize && thm.initialize[i] ? thm.initialize[i] : null,
- thmDesc = thm.description && thm.description[i] ? thm.description[i] : null;
-
- //Registers theme
- this.Thm.add(thmName, thmDesc, thmPath, thmInit);
-
- if (!this.isImported(thmPath, 'link')) {
- this.includeFile(thmName, thmPath, null, 'link');
- }
- if (_types.Types.isFn(thmInit)) {
- thmInit.call(null, this);
- }
- }
- }
-
- //Some elements need to be overriden for theme
- //Reset button
- this.btnResetText = null;
- this.btnResetHtml = ' ';
-
- //Paging buttons
- this.btnPrevPageHtml = ' ';
- this.btnNextPageHtml = ' ';
- this.btnFirstPageHtml = ' ';
- this.btnLastPageHtml = ' ';
-
- //Loader
- this.loader = true;
- this.loaderHtml = '
';
- this.loaderText = null;
- }
- }, {
- key: 'remove',
-
- /*====================================================
- - removes a filter grid
- =====================================================*/
- value: function remove() {
- if (this.fltGrid && this._hasGrid) {
- var rows = this.tbl.rows;
- if (this.paging) {
- this.Cpt.paging.destroy();
- }
- if (this.statusBar) {
- this.Cpt.statusBar.destroy();
- }
- if (this.rowsCounter) {
- this.Cpt.rowsCounter.destroy();
- }
- if (this.btnReset) {
- this.Cpt.clearButton.destroy();
- }
- if (this.helpInstructions) {
- this.Cpt.help.destroy();
- }
- if (this.isExternalFlt && !this.popUpFilters) {
- this.removeExternalFlts();
- }
- if (this.infDiv) {
- this.removeToolbar();
- }
- if (this.highlightKeywords) {
- this.Cpt.highlightKeyword.unhighlightAll();
- }
- if (this.sort) {
- // this.RemoveSort();
- this.ExtRegistry.sort.destroy();
- }
- if (this.loader) {
- this.Cpt.loader.remove();
- }
- if (this.popUpFilters) {
- this.Cpt.popupFilter.destroy();
- }
- if (this.markActiveColumns) {
- this.clearActiveColumns();
- }
- if (this.editable || this.selectable) {
- this.removeEditable();
- }
- //this loop shows all rows and removes validRow attribute
- for (var j = this.refRow; j < this.nbRows; j++) {
- rows[j].style.display = '';
- try {
- if (rows[j].hasAttribute('validRow')) {
- rows[j].removeAttribute('validRow');
- }
- } catch (e) {
- //ie<=6 doesn't support hasAttribute method
- var row = rows[j];
- var attribs = row.attributes;
- for (var x = 0; x < attribs.length; x++) {
- if (_string.Str.lower(attribs.nodeName) === 'validrow') {
- row.removeAttribute('validRow');
- }
- }
- }
-
- //removes alternating colors
- if (this.alternateBgs) {
- this.Cpt.alternateRows.removeRowBg(j);
- }
- } //for j
-
- if (this.fltGrid && !this.gridLayout) {
- this.fltGridEl = rows[this.filtersRowIndex];
- this.tbl.deleteRow(this.filtersRowIndex);
- }
- if (this.gridLayout) {
- this.Cpt.gridLayout.destroy();
- }
- _dom.Dom.removeClass(this.tbl, this.prfxTf);
- this.activeFlt = null;
- this.isStartBgAlternate = true;
- this._hasGrid = false;
- this.tbl = null;
- } //if this.fltGrid
- }
- }, {
- key: 'setToolbar',
-
- /*====================================================
- - Generates div above table where paging,
- reset button, rows counter label etc. are placed
- =====================================================*/
- value: function setToolbar() {
- if (this.infDiv !== null) {
- return;
- }
-
- /*** container div ***/
- var infdiv = _dom.Dom.create('div', ['id', this.prfxInfDiv + this.id]);
- infdiv.className = this.infDivCssClass;
-
- //custom container
- if (this.toolBarTgtId) {
- _dom.Dom.id(this.toolBarTgtId).appendChild(infdiv);
- }
- //grid-layout
- else if (this.gridLayout) {
- var gridLayout = this.Cpt.gridLayout;
- gridLayout.tblMainCont.appendChild(infdiv);
- infdiv.className = gridLayout.gridInfDivCssClass;
- }
- //default location: just above the table
- else {
- this.tbl.parentNode.insertBefore(infdiv, this.tbl);
- }
- this.infDiv = _dom.Dom.id(this.prfxInfDiv + this.id);
-
- /*** left div containing rows # displayer ***/
- var ldiv = _dom.Dom.create('div', ['id', this.prfxLDiv + this.id]);
- ldiv.className = this.lDivCssClass;
- infdiv.appendChild(ldiv);
- this.lDiv = _dom.Dom.id(this.prfxLDiv + this.id);
-
- /*** right div containing reset button
- + nb results per page select ***/
- var rdiv = _dom.Dom.create('div', ['id', this.prfxRDiv + this.id]);
- rdiv.className = this.rDivCssClass;
- infdiv.appendChild(rdiv);
- this.rDiv = _dom.Dom.id(this.prfxRDiv + this.id);
-
- /*** mid div containing paging elements ***/
- var mdiv = _dom.Dom.create('div', ['id', this.prfxMDiv + this.id]);
- mdiv.className = this.mDivCssClass;
- infdiv.appendChild(mdiv);
- this.mDiv = _dom.Dom.id(this.prfxMDiv + this.id);
-
- // Enable help instructions by default is topbar is generated
- if (!this.helpInstructions) {
- if (!this.Cpt.help) {
- // var Help = require('modules/help').Help;
- // import {Help} from 'modules/help';
- this.Cpt.help = new _modulesHelp.Help(this);
- }
- this.Cpt.help.init();
- }
- }
- }, {
- key: 'removeToolbar',
-
- /*====================================================
- - Removes div above table where paging,
- reset button, rows counter label etc. are placed
- =====================================================*/
- value: function removeToolbar() {
- if (!this.infDiv) {
- return;
- }
- this.infDiv.parentNode.removeChild(this.infDiv);
- this.infDiv = null;
- }
- }, {
- key: 'removeExternalFlts',
-
- /*====================================================
- - removes external filters
- =====================================================*/
- value: function removeExternalFlts() {
- if (!this.isExternalFlt && !this.externalFltTgtIds) {
- return;
- }
- for (var ct = 0; ct < this.externalFltTgtIds.length; ct++) {
- var externalFltTgtId = this.externalFltTgtIds[ct],
- externalFlt = _dom.Dom.id(externalFltTgtId);
- if (externalFlt) {
- externalFlt.innerHTML = '';
- }
- }
- }
- }, {
- key: 'setSort',
-
- /*====================================================
- - Sets sorting feature by loading
- WebFX Sortable Table 1.12 plugin by Erik Arvidsson
- and TF adapter by Max Guglielmi
- =====================================================*/
- value: function setSort() {
-
- // require(['adapterSortabletable'], (m)=> {
- // var adapterSortabletable = new m.AdapterSortableTable(this);
- // this.ExtRegistry.sort = adapterSortabletable;
- // adapterSortabletable.init();
- // });
-
- this.loadExtension({
- name: 'adapterSortabletable.js',
- path: './extensions/sortabletable'
- });
- }
- }, {
- key: 'performSort',
- value: function performSort() {
- this.EvtManager(this.Evt.name.sort);
- }
- }, {
- key: 'setEditable',
-
- /*====================================================
- - Sets selection or edition features by loading
- ezEditTable script by Max Guglielmi
- =====================================================*/
- value: function setEditable() {
- var ezEditConfig = this.ezEditTableConfig;
- if (this.isImported(ezEditConfig.src)) {
- this._enableEditable();
- } else {
- this.includeFile(ezEditConfig.name, ezEditConfig.src, this._enableEditable);
- }
- if (ezEditConfig.loadStylesheet && !this.isImported(ezEditConfig.stylesheet, 'link')) {
- this.includeFile(ezEditConfig.stylesheetName, ezEditConfig.stylesheet, null, 'link');
- }
- }
- }, {
- key: 'removeEditable',
-
- /*====================================================
- - Removes selection or edition features
- =====================================================*/
- value: function removeEditable() {
- var ezEditTable = this.ezEditTable;
- if (ezEditTable) {
- if (this.selectable) {
- ezEditTable.Selection.ClearSelections();
- ezEditTable.Selection.Remove();
- }
- if (this.editable) {
- ezEditTable.Editable.Remove();
- }
- }
- }
- }, {
- key: 'resetEditable',
-
- /*====================================================
- - Resets selection or edition features after
- removal
- =====================================================*/
- value: function resetEditable() {
- var ezEditTable = this.ezEditTable;
- if (ezEditTable) {
- if (this.selectable) {
- ezEditTable.Selection.Set();
- }
- if (this.editable) {
- ezEditTable.Editable.Set();
- }
- }
- }
- }, {
- key: '_enableEditable',
- value: function _enableEditable(o) {
- if (!o) {
- o = this;
- }
-
- //start row for EditTable constructor needs to be calculated
- var startRow,
- ezEditConfig = o.ezEditTableConfig,
- thead = _dom.Dom.tag(o.tbl, 'thead');
-
- //if thead exists and startRow not specified, startRow is calculated
- //automatically by EditTable
- if (thead.length > 0 && !ezEditConfig.startRow) {
- startRow = undefined;
- }
- //otherwise startRow config property if any or TableFilter refRow
- else {
- startRow = ezEditConfig.startRow || o.refRow;
- }
-
- ezEditConfig.scroll_into_view = ezEditConfig.scroll_into_view === false ? false : true;
- ezEditConfig.base_path = ezEditConfig.base_path || o.basePath + 'ezEditTable/';
- ezEditConfig.editable = o.editable = o.cfg.editable;
- ezEditConfig.selection = o.selectable = o.cfg.selectable;
-
- if (o.selectable) {
- ezEditConfig.default_selection = ezEditConfig.default_selection || 'row';
- }
- //CSS Styles
- ezEditConfig.active_cell_css = ezEditConfig.active_cell_css || 'ezETSelectedCell';
-
- o._lastValidRowIndex = 0;
- o._lastRowIndex = 0;
-
- if (o.selectable) {
- //Row navigation needs to be calculated according to TableFilter's
- //validRowsIndex array
- var onAfterSelection = function onAfterSelection(et, selectedElm, e) {
- var slc = et.Selection;
- //Next valid filtered row needs to be selected
- var doSelect = function doSelect(nextRowIndex) {
- if (et.defaultSelection === 'row') {
- slc.SelectRowByIndex(nextRowIndex);
- } else {
- et.ClearSelections();
- var cellIndex = selectedElm.cellIndex,
- row = o.tbl.rows[nextRowIndex];
- if (et.defaultSelection === 'both') {
- slc.SelectRowByIndex(nextRowIndex);
- }
- if (row) {
- slc.SelectCell(row.cells[cellIndex]);
- }
- }
- //Table is filtered
- if (o.validRowsIndex.length !== o.getRowsNb()) {
- var r = o.tbl.rows[nextRowIndex];
- if (r) {
- r.scrollIntoView(false);
- }
- if (cell) {
- if (cell.cellIndex === o.getCellsNb() - 1 && o.gridLayout) {
- o.tblCont.scrollLeft = 100000000;
- } else if (cell.cellIndex === 0 && o.gridLayout) {
- o.tblCont.scrollLeft = 0;
- } else {
- cell.scrollIntoView(false);
- }
- }
- }
- };
-
- //table is not filtered
- if (!o.validRowsIndex) {
- return;
- }
- var validIndexes = o.validRowsIndex,
- validIdxLen = validIndexes.length,
- row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm,
-
- //cell for default_selection = 'both' or 'cell'
- cell = selectedElm.nodeName === 'TD' ? selectedElm : null,
- keyCode = e !== undefined ? et.Event.GetKey(e) : 0,
- isRowValid = _array.Arr.has(validIndexes, row.rowIndex),
- nextRowIndex,
-
- //pgup/pgdown keys
- d = keyCode === 34 || keyCode === 33 ? o.pagingLength || et.nbRowsPerPage : 1;
-
- //If next row is not valid, next valid filtered row needs to be
- //calculated
- if (!isRowValid) {
- //Selection direction up/down
- if (row.rowIndex > o._lastRowIndex) {
- //last row
- if (row.rowIndex >= validIndexes[validIdxLen - 1]) {
- nextRowIndex = validIndexes[validIdxLen - 1];
- } else {
- var calcRowIndex = o._lastValidRowIndex + d;
- if (calcRowIndex > validIdxLen - 1) {
- nextRowIndex = validIndexes[validIdxLen - 1];
- } else {
- nextRowIndex = validIndexes[calcRowIndex];
- }
- }
- } else {
- //first row
- if (row.rowIndex <= validIndexes[0]) {
- nextRowIndex = validIndexes[0];
- } else {
- var v = validIndexes[o._lastValidRowIndex - d];
- nextRowIndex = v ? v : validIndexes[0];
- }
- }
- o._lastRowIndex = row.rowIndex;
- doSelect(nextRowIndex);
- } else {
- //If filtered row is valid, special calculation for
- //pgup/pgdown keys
- if (keyCode !== 34 && keyCode !== 33) {
- o._lastValidRowIndex = _array.Arr.indexByValue(validIndexes, row.rowIndex);
- o._lastRowIndex = row.rowIndex;
- } else {
- if (keyCode === 34) {
- //pgdown
- //last row
- if (o._lastValidRowIndex + d <= validIdxLen - 1) {
- nextRowIndex = validIndexes[o._lastValidRowIndex + d];
- } else {
- nextRowIndex = [validIdxLen - 1];
- }
- } else {
- //pgup
- //first row
- if (o._lastValidRowIndex - d <= validIndexes[0]) {
- nextRowIndex = validIndexes[0];
- } else {
- nextRowIndex = validIndexes[o._lastValidRowIndex - d];
- }
- }
- o._lastRowIndex = nextRowIndex;
- o._lastValidRowIndex = _array.Arr.indexByValue(validIndexes, nextRowIndex);
- doSelect(nextRowIndex);
- }
- }
- };
-
- //Page navigation has to be enforced whenever selected row is out of
- //the current page range
- var onBeforeSelection = function onBeforeSelection(et, selectedElm, e) {
- var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm;
- if (o.paging) {
- if (o.Cpt.paging.nbPages > 1) {
- var paging = o.Cpt.paging;
- //page length is re-assigned in case it has changed
- et.nbRowsPerPage = paging.pagingLength;
- var validIndexes = o.validRowsIndex,
- validIdxLen = validIndexes.length,
- pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10);
- var rowIndex = row.rowIndex;
-
- if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) {
- paging.setPage('last');
- } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) {
- paging.setPage('first');
- } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) {
- paging.setPage('next');
- } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) {
- paging.setPage('previous');
- }
- }
- }
- };
-
- //Selected row needs to be visible when paging is activated
- if (o.paging) {
- o.onAfterChangePage = function (tf, i) {
- var et = tf.ExtRegistry.ezEditTable;
- var slc = et.Selection;
- var row = slc.GetActiveRow();
- if (row) {
- row.scrollIntoView(false);
- }
- var cell = slc.GetActiveCell();
- if (cell) {
- cell.scrollIntoView(false);
- }
- };
- }
-
- //Rows navigation when rows are filtered is performed with the
- //EditTable row selection callback events
- if (ezEditConfig.default_selection === 'row') {
- var fnB = ezEditConfig.on_before_selected_row;
- ezEditConfig.on_before_selected_row = function () {
- onBeforeSelection(arguments[0], arguments[1], arguments[2]);
- if (fnB) {
- fnB.call(null, arguments[0], arguments[1], arguments[2]);
- }
- };
- var fnA = ezEditConfig.on_after_selected_row;
- ezEditConfig.on_after_selected_row = function () {
- onAfterSelection(arguments[0], arguments[1], arguments[2]);
- if (fnA) {
- fnA.call(null, arguments[0], arguments[1], arguments[2]);
- }
- };
- } else {
- var fnD = ezEditConfig.on_before_selected_cell;
- ezEditConfig.on_before_selected_cell = function () {
- onBeforeSelection(arguments[0], arguments[1], arguments[2]);
- if (fnD) {
- fnD.call(null, arguments[0], arguments[1], arguments[2]);
- }
- };
- var fnC = ezEditConfig.on_after_selected_cell;
- ezEditConfig.on_after_selected_cell = function () {
- onAfterSelection(arguments[0], arguments[1], arguments[2]);
- if (fnC) {
- fnC.call(null, arguments[0], arguments[1], arguments[2]);
- }
- };
- }
- }
- if (o.editable) {
- //Added or removed rows, TF rows number needs to be re-calculated
- var fnE = ezEditConfig.on_added_dom_row;
- ezEditConfig.on_added_dom_row = function () {
- o.nbFilterableRows++;
- if (!o.paging) {
- o.Cpt.rowsCounter.refresh();
- } else {
- o.nbRows++;
- o.nbVisibleRows++;
- o.nbFilterableRows++;
- o.paging = false;
- o.Cpt.paging.destroy();
- o.Cpt.paging.addPaging();
- }
- if (o.alternateBgs) {
- o.Cpt.alternateRows.init();
- }
- if (fnE) {
- fnE.call(null, arguments[0], arguments[1], arguments[2]);
- }
- };
- if (ezEditConfig.actions && ezEditConfig.actions['delete']) {
- var fnF = ezEditConfig.actions['delete'].on_after_submit;
- ezEditConfig.actions['delete'].on_after_submit = function () {
- o.nbFilterableRows--;
- if (!o.paging) {
- o.Cpt.rowsCounter.refresh();
- } else {
- o.nbRows--;
- o.nbVisibleRows--;
- o.nbFilterableRows--;
- o.paging = false;
- o.Cpt.paging.destroy();
- o.Cpt.paging.addPaging(false);
- }
- if (o.alternateBgs) {
- o.Cpt.alternateRows.init();
- }
- if (fnF) {
- fnF.call(null, arguments[0], arguments[1]);
- }
- };
- }
- }
-
- try {
- o.ExtRegistry.ezEditTable = new EditTable(o.id, ezEditConfig, startRow);
- o.ExtRegistry.ezEditTable.Init();
- } catch (e) {
- console.log(ezEditConfig.err);
- }
- }
- }, {
- key: 'resetValues',
-
- /*====================================================
- - IE bug: it seems there is no way to make
- multiple selections programatically, only last
- selection is kept (multiple select previously
- populated via DOM)
- - Work-around: defer selection with a setTimeout
- If you find a more elegant solution to
- this let me know ;-)
- - For the moment only this solution seems to work!
- - Params:
- - slc = select object (select obj)
- - index to be selected (integer)
- - execute filtering (boolean)
- =====================================================*/
- // __deferMultipleSelection: function(slc,index,filter){
- // if(str.lower(slc.nodeName)!=='select'){
- // return;
- // }
- // var doFilter = filter===undefined ? false : filter;
- // var o = this;
- // global.setTimeout(function(){
- // slc.options[0].selected = false;
-
- // if(slc.options[index].value===''){
- // slc.options[index].selected = false;
- // }
- // else{
- // slc.options[index].selected = true;
- // if(doFilter){
- // o.filter();
- // }
- // }
- // }, 0.1);
- // },
-
- /*====================================================
- - Returns an array [[values],[texts]] with
- custom values for a given filter
- - Param: column index (integer)
- =====================================================*/
- // _getCustomValues: function(colIndex){
- // if(!colIndex){
- // return;
- // }
- // //custom select test
- // var isCustomSlc = this.hasCustomSlcOptions &&
- // array.has(this.customSlcOptions.cols, colIndex);
- // if(!isCustomSlc){
- // return;
- // }
- // var optTxt = [], optArray = [];
- // var index = array.indexByValue(this.customSlcOptions.cols, colIndex);
- // var slcValues = this.customSlcOptions.values[index];
- // var slcTexts = this.customSlcOptions.texts[index];
- // var slcSort = this.customSlcOptions.sorts[index];
- // for(var r=0; r= dte2;
- }
- // greater date
- else if (isGDate) {
- dte2 = formatDate(sA.replace(re_g, ''), dtType);
- occurence = dte1 > dte2;
- }
- // different date
- else if (isDFDate) {
- dte2 = formatDate(sA.replace(re_d, ''), dtType);
- occurence = dte1.toString() != dte2.toString();
- }
- // equal date
- else if (isEQDate) {
- dte2 = formatDate(sA.replace(re_eq, ''), dtType);
- occurence = dte1.toString() == dte2.toString();
- }
- // searched keyword with * operator doesn't have to be a date
- else if (re_lk.test(sA)) {
- // like date
- occurence = o._containsStr(sA.replace(re_lk, ''), cell_data, null, false);
- } else if (isValidDate(sA, dtType)) {
- dte2 = formatDate(sA, dtType);
- occurence = dte1.toString() == dte2.toString();
- }
- //empty
- else if (hasEM) {
- occurence = _string.Str.isEmpty(cell_data);
- }
- //non-empty
- else if (hasNM) {
- occurence = !_string.Str.isEmpty(cell_data);
- }
- } else {
- //first numbers need to be formated
- if (o.hasColNbFormat && o.colNbFormat[j]) {
- num_cell_data = removeNbFormat(cell_data, o.colNbFormat[j]);
- nbFormat = o.colNbFormat[j];
- } else {
- if (o.thousandsSeparator === ',' && o.decimalSeparator === '.') {
- num_cell_data = removeNbFormat(cell_data, 'us');
- nbFormat = 'us';
- } else {
- num_cell_data = removeNbFormat(cell_data, 'eu');
- nbFormat = 'eu';
- }
- }
-
- // first checks if there is any operator (<,>,<=,>=,!,*,=,{,},
- // rgx:)
- // lower equal
- if (hasLE) {
- occurence = num_cell_data <= removeNbFormat(sA.replace(re_le, ''), nbFormat);
- }
- //greater equal
- else if (hasGE) {
- occurence = num_cell_data >= removeNbFormat(sA.replace(re_ge, ''), nbFormat);
- }
- //lower
- else if (hasLO) {
- occurence = num_cell_data < removeNbFormat(sA.replace(re_l, ''), nbFormat);
- }
- //greater
- else if (hasGR) {
- occurence = num_cell_data > removeNbFormat(sA.replace(re_g, ''), nbFormat);
- }
- //different
- else if (hasDF) {
- occurence = o._containsStr(sA.replace(re_d, ''), cell_data) ? false : true;
- }
- //like
- else if (hasLK) {
- occurence = o._containsStr(sA.replace(re_lk, ''), cell_data, null, false);
- }
- //equal
- else if (hasEQ) {
- occurence = o._containsStr(sA.replace(re_eq, ''), cell_data, null, true);
- }
- //starts with
- else if (hasST) {
- occurence = cell_data.indexOf(sA.replace(re_st, '')) === 0 ? true : false;
- }
- //ends with
- else if (hasEN) {
- var searchArg = sA.replace(re_en, '');
- occurence = cell_data.lastIndexOf(searchArg, cell_data.length - 1) === cell_data.length - 1 - (searchArg.length - 1) && cell_data.lastIndexOf(searchArg, cell_data.length - 1) > -1 ? true : false;
- }
- //empty
- else if (hasEM) {
- occurence = _string.Str.isEmpty(cell_data);
- }
- //non-empty
- else if (hasNM) {
- occurence = !_string.Str.isEmpty(cell_data);
- }
- //regexp
- else if (hasRE) {
- //in case regexp fires an exception
- try {
- //operator is removed
- var srchArg = sA.replace(re_re, '');
- var rgx = new RegExp(srchArg);
- occurence = rgx.test(cell_data);
- } catch (e) {
- occurence = false;
- }
- } else {
- var fCol = f['col_' + j];
- occurence = o._containsStr(sA, cell_data, !fCol ? o.fltTypeInp : fCol);
- }
- } //else
- return occurence;
- } //fn
-
- for (var k = this.refRow; k < this.nbRows; k++) {
- /*** if table already filtered some rows are not visible ***/
- if (row[k].style.display === 'none') {
- row[k].style.display = '';
- }
-
- var cell = row[k].cells,
- nchilds = cell.length;
-
- // checks if row has exact cell #
- if (nchilds !== this.nbCells) {
- continue;
- }
-
- var occurence = [],
- isRowValid = this.searchType === 'include' ? true : false,
-
- //only for single filter search
- singleFltRowValid = false;
-
- // this loop retrieves cell data
- for (var j = 0; j < nchilds; j++) {
- //searched keyword
- var sA = this.searchArgs[this.singleSearchFlt ? 0 : j],
- dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType;
- if (sA === '') {
- continue;
- }
-
- var cell_data = _string.Str.matchCase(this.getCellData(j, cell[j]), this.matchCase);
-
- //multiple search parameter operator ||
- var sAOrSplit = sA.split(this.orOperator),
-
- //multiple search || parameter boolean
- hasMultiOrSA = sAOrSplit.length > 1 ? true : false,
-
- //multiple search parameter operator &&
- sAAndSplit = sA.split(this.anOperator),
-
- //multiple search && parameter boolean
- hasMultiAndSA = sAAndSplit.length > 1 ? true : false;
-
- //multiple sarch parameters
- if (hasMultiOrSA || hasMultiAndSA) {
- var cS,
- occur = false,
- s = hasMultiOrSA ? sAOrSplit : sAAndSplit;
- for (var w = 0; w < s.length; w++) {
- cS = _string.Str.trim(s[w]);
- occur = hasArg(cS, cell_data, j);
- highlight(cS, occur, cell[j]);
- if (hasMultiOrSA && occur) {
- break;
- }
- if (hasMultiAndSA && !occur) {
- break;
- }
- }
- occurence[j] = occur;
- }
- //single search parameter
- else {
- occurence[j] = hasArg(_string.Str.trim(sA), cell_data, j);
- highlight(sA, occurence[j], cell[j]);
- } //else single param
-
- if (!occurence[j]) {
- isRowValid = this.searchType === 'include' ? false : true;
- }
- if (this.singleSearchFlt && occurence[j]) {
- singleFltRowValid = true;
- }
- if (this.popUpFilters) {
- this.Cpt.popupFilter.buildIcon(j, true);
- }
- if (this.markActiveColumns) {
- if (k === this.refRow) {
- if (this.onBeforeActiveColumn) {
- this.onBeforeActiveColumn.call(null, this, j);
- }
- _dom.Dom.addClass(this.getHeaderElement(j), this.activeColumnsCssClass);
- if (this.onAfterActiveColumn) {
- this.onAfterActiveColumn.call(null, this, j);
- }
- }
- }
- } //for j
-
- if (this.singleSearchFlt && singleFltRowValid) {
- isRowValid = true;
- }
-
- if (!isRowValid) {
- this.validateRow(k, false);
- // always visible rows need to be counted as valid
- if (this.hasVisibleRows && _array.Arr.has(this.visibleRows, k) && !this.paging) {
- this.validRowsIndex.push(k);
- } else {
- hiddenrows++;
- }
- } else {
- this.validateRow(k, true);
- this.validRowsIndex.push(k);
- if (this.alternateBgs) {
- this.Cpt.alternateRows.setRowBg(k, this.validRowsIndex.length);
- }
- if (this.onRowValidated) {
- this.onRowValidated.call(null, this, k);
- }
- }
- } // for k
-
- this.nbVisibleRows = this.validRowsIndex.length;
- this.nbHiddenRows = hiddenrows;
- this.isStartBgAlternate = false;
-
- if (this.rememberGridValues) {
- this.Cpt.store.saveFilterValues(this.fltsValuesCookie);
- }
- //applies filter props after filtering process
- if (!this.paging) {
- this.applyGridProps();
- } else {
- this.startPagingRow = 0;
- this.currentPageNb = 1;
- this.Cpt.paging.setPagingInfo(this.validRowsIndex);
- } //starts paging process
- //invokes onafter callback
- if (this.onAfterFilter) {
- this.onAfterFilter.call(null, this);
- }
- }
- }, {
- key: 'applyGridProps',
-
- /*====================================================
- - checks methods that should be called
- after filtering and/or paging process
- =====================================================*/
- value: function applyGridProps() {
- // blurs active filter (IE)
- if (this.activeFlt && _string.Str.lower(this.activeFlt.nodeName) === this.fltTypeSlc && !this.popUpFilters) {
- this.activeFlt.blur();
- if (this.activeFlt.parentNode) {
- this.activeFlt.parentNode.focus();
- }
- }
-
- //shows rows always visible
- if (this.visibleRows) {
- this.enforceVisibility();
- }
- //makes operation on a col
- if (this.hasColOperation) {
- this.Cpt.colOps.calc();
- }
- //re-populates drop-down filters
- if (this.linkedFilters) {
- this.linkFilters();
- }
- var nr = !this.paging && this.hasVisibleRows ? this.nbVisibleRows - this.visibleRows.length : this.nbVisibleRows;
- //refreshes rows counter
- if (this.rowsCounter) {
- this.Cpt.rowsCounter.refresh(nr);
- }
-
- if (this.popUpFilters) {
- this.Cpt.popupFilter.closeAll();
- }
- }
- }, {
- key: 'getColValues',
-
- /*====================================================
- - returns an array containing cell values of
- a column
- - needs following args:
- - column index (number)
- - a boolean set to true if we want only
- numbers to be returned
- - array containing rows index to be excluded
- from returned values
- =====================================================*/
- value: function getColValues(colindex, num, exclude) {
- if (!this.fltGrid) {
- return;
- }
- var row = this.tbl.rows,
- colValues = [];
-
- for (var i = this.refRow; i < this.nbRows; i++) {
- var isExludedRow = false;
- // checks if current row index appears in exclude array
- if (exclude && _types.Types.isArray(exclude)) {
- isExludedRow = _array.Arr.has(exclude, i); //boolean
- }
- var cell = row[i].cells,
- nchilds = cell.length;
-
- // checks if row has exact cell # and is not excluded
- if (nchilds == this.nbCells && !isExludedRow) {
- // this loop retrieves cell data
- for (var j = 0; j < nchilds; j++) {
- if (j === colindex && row[i].style.display === '') {
- var cell_data = _string.Str.lower(this.getCellData(j, cell[j])),
- nbFormat = this.colNbFormat ? this.colNbFormat[colindex] : null,
- data = num ? removeNbFormat(cell_data, nbFormat) : cell_data;
- colValues.push(data);
- }
- }
- }
- } //for i
- return colValues;
- }
- }, {
- key: 'getFilterValue',
-
- /*====================================================
- - Returns value of a specified filter
- - Params:
- - index: filter column index (numeric value)
- =====================================================*/
- value: function getFilterValue(index) {
- if (!this.fltGrid) {
- return;
- }
- var fltValue,
- flt = this.getFilterElement(index);
- if (!flt) {
- return '';
- }
- var fltColType = this.fltCol[index];
- if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) {
- fltValue = flt.value;
- }
- //mutiple select
- else if (fltColType === this.fltTypeMulti) {
- fltValue = '';
- for (var j = 0; j < flt.options.length; j++) {
- if (flt.options[j].selected) {
- fltValue = fltValue.concat(flt.options[j].value + ' ' + this.orOperator + ' ');
- }
- }
- //removes last operator ||
- fltValue = fltValue.substr(0, fltValue.length - 4);
- }
- //checklist
- else if (fltColType === this.fltTypeCheckList) {
- if (flt.getAttribute('value') !== null) {
- fltValue = flt.getAttribute('value');
- //removes last operator ||
- fltValue = fltValue.substr(0, fltValue.length - 3);
- } else {
- fltValue = '';
- }
- }
- return fltValue;
- }
- }, {
- key: 'getFiltersValue',
-
- /*====================================================
- - Returns the value of every single filter
- =====================================================*/
- value: function getFiltersValue() {
- if (!this.fltGrid) {
- return;
- }
- var searchArgs = [];
- for (var i = 0; i < this.fltIds.length; i++) {
- searchArgs.push(_string.Str.trim(_string.Str.matchCase(this.getFilterValue(i), this.matchCase)));
- }
- return searchArgs;
- }
- }, {
- key: 'getFilterId',
-
- /*====================================================
- - Returns filter id of a specified column
- - Params:
- - index: column index (numeric value)
- =====================================================*/
- value: function getFilterId(index) {
- if (!this.fltGrid) {
- return;
- }
- return this.fltIds[i];
- }
- }, {
- key: 'getFiltersByType',
-
- /*====================================================
- - returns an array containing ids of filters of a
- specified type (inputs or selects)
- - Note that hidden filters are also returned
- - Needs folllowing args:
- - filter type string ('input','select',
- 'multiple')
- - optional boolean: if set true method
- returns column indexes otherwise filters ids
- =====================================================*/
- value: function getFiltersByType(type, bool) {
- if (!this.fltGrid) {
- return;
- }
- var arr = [];
- for (var i = 0; i < this.fltIds.length; i++) {
- var fltType = this['col' + i];
- if (fltType === _string.Str.lower(type)) {
- var a = bool ? i : this.fltIds[i];
- arr.push(a);
- }
- }
- return arr;
- }
- }, {
- key: 'getFilterElement',
-
- /*====================================================
- - returns filter DOM element for a given column
- index
- =====================================================*/
- value: function getFilterElement(index) {
- if (!this.fltGrid) {
- return null;
- }
- return _dom.Dom.id(this.fltIds[index]);
- }
- }, {
- key: 'getCellsNb',
-
- /*====================================================
- - returns number of cells in a row
- - if rowIndex param is passed returns number of
- cells of specified row (number)
- =====================================================*/
- value: function getCellsNb(rowIndex) {
- var tr = !rowIndex ? this.tbl.rows[0] : this.tbl.rows[rowIndex];
- return tr.cells.length;
- }
- }, {
- key: 'getRowsNb',
-
- /*====================================================
- - returns total nb of filterable rows starting
- from reference row if defined
- - Param:
- - includeHeaders: if true header rows are
- included in calculation(= table rows number)
- =====================================================*/
- value: function getRowsNb(includeHeaders) {
- var s = !this.refRow ? 0 : this.refRow,
- ntrs = this.tbl.rows.length;
- if (includeHeaders) {
- s = 0;
- }
- return parseInt(ntrs - s, 10);
- }
- }, {
- key: 'getCellData',
-
- /*====================================================
- - returns text content of a given cell
- - Params:
- - i: index of the column (number)
- - cell: td DOM object
- =====================================================*/
- value: function getCellData(i, cell) {
- if (i === undefined || !cell) {
- return '';
- }
- //First checks for customCellData event
- if (this.customCellData && _array.Arr.has(this.customCellDataCols, i)) {
- return this.customCellData.call(null, this, cell, i);
- } else {
- return _dom.Dom.getText(cell);
- }
- }
- }, {
- key: 'getTableData',
-
- /*====================================================
- - returns an array containing table data:
- [rowindex,[value1,value2,value3...]]
- =====================================================*/
- value: function getTableData() {
- var row = this.tbl.rows;
- for (var k = this.refRow; k < this.nbRows; k++) {
- var rowData = [k, []];
- var cells = row[k].cells;
- // this loop retrieves cell data
- for (var j = 0; j < cells.length; j++) {
- var cell_data = this.getCellData(j, cells[j]);
- rowData[1].push(cell_data);
- }
- this.tblData.push(rowData);
- }
- return this.tblData;
- }
- }, {
- key: 'getFilteredData',
-
- /*====================================================
- - returns an array containing filtered data:
- [rowindex,[value1,value2,value3...]]
- =====================================================*/
- value: function getFilteredData(includeHeaders) {
- if (!this.validRowsIndex) {
- return [];
- }
- var row = this.tbl.rows,
- filteredData = [];
- if (includeHeaders) {
- var table = this.gridLayout ? this.Cpt.gridLayout.headTbl : this.tbl,
- r = table.rows[this.headersRow],
- rowData = [r.rowIndex, []];
- for (var j = 0; j < this.nbCells; j++) {
- var headerText = this.getCellData(j, r.cells[j]);
- rowData[1].push(headerText);
- }
- filteredData.push(rowData);
- }
-
- var validRows = this.getValidRowsIndex(true);
- for (var i = 0; i < validRows.length; i++) {
- var rData = [this.validRowsIndex[i], []],
- cells = row[this.validRowsIndex[i]].cells;
- for (var k = 0; k < cells.length; k++) {
- var cell_data = this.getCellData(k, cells[k]);
- rData[1].push(cell_data);
- }
- filteredData.push(rData);
- }
- return filteredData;
- }
- }, {
- key: 'getFilteredDataCol',
-
- /*====================================================
- - returns an array containing filtered data of a
- specified column.
- - Params:
- - colIndex: index of the column (number)
- - returned array:
- [value1,value2,value3...]
- =====================================================*/
- value: function getFilteredDataCol(colIndex) {
- if (colIndex === undefined) {
- return [];
- }
- var data = this.getFilteredData(),
- colData = [];
- for (var i = 0; i < data.length; i++) {
- var r = data[i],
-
- //cols values of current row
- d = r[1],
-
- //data of searched column
- c = d[colIndex];
- colData.push(c);
- }
- return colData;
- }
- }, {
- key: 'getRowDisplay',
- value: function getRowDisplay(row) {
- if (!this.fltGrid && !_types.Types.isObj(row)) {
- return;
- }
- return row.style.display;
- }
- }, {
- key: 'validateRow',
-
- /*====================================================
- - Validates/unvalidates row by setting 'validRow'
- attribute and shows/hides row
- - Params:
- - rowIndex: index of the row (number)
- - isValid: boolean
- =====================================================*/
- value: function validateRow(rowIndex, isValid) {
- var row = this.tbl.rows[rowIndex];
- if (!row || _string.Str.lower(typeof isValid) !== 'boolean') {
- return;
- }
-
- // always visible rows are valid
- if (this.hasVisibleRows && _array.Arr.has(this.visibleRows, rowIndex) && !this.paging) {
- isValid = true;
- }
-
- var displayFlag = isValid ? '' : 'none',
- validFlag = isValid ? 'true' : 'false';
- row.style.display = displayFlag;
-
- if (this.paging) {
- row.setAttribute('validRow', validFlag);
- }
- }
- }, {
- key: 'validateAllRows',
-
- /*====================================================
- - Validates all filterable rows
- =====================================================*/
- value: function validateAllRows() {
- if (!this._hasGrid) {
- return;
- }
- this.validRowsIndex = [];
- for (var k = this.refRow; k < this.nbFilterableRows; k++) {
- this.validateRow(k, true);
- this.validRowsIndex.push(k);
- }
- }
- }, {
- key: 'setFilterValue',
-
- /*====================================================
- - Inserts value in a specified filter
- - Params:
- - index: filter column index (numeric value)
- - searcharg: search string
- - doFilter: optional boolean for multiple
- selects: executes filtering when multiple
- select populated... IE only!
- =====================================================*/
- value: function setFilterValue(index, searcharg, doFilter) {
- if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) {
- return;
- }
- var slc = this.getFilterElement(index),
- execFilter = doFilter === undefined ? true : doFilter,
- fltColType = this['col' + index];
- searcharg = searcharg === undefined ? '' : searcharg;
-
- if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) {
- slc.value = searcharg;
- }
- //multiple selects
- else if (fltColType === this.fltTypeMulti) {
- var s = searcharg.split(' ' + this.orOperator + ' '),
- ct = 0; //keywords counter
- for (var j = 0; j < slc.options.length; j++) {
- if (s === '' || s[0] === '') {
- slc.options[j].selected = false;
- }
- if (slc.options[j].value === '') {
- slc.options[j].selected = false;
- }
- if (slc.options[j].value !== '' && _array.Arr.has(s, slc.options[j].value, true)) {
- // IE multiple selection work-around
- // if(hlp.isIE()){
- // //when last value reached filtering can be executed
- // var filter = ct==(s.length-1) && execFilter ?
- // true : false;
- // this.__deferMultipleSelection(slc,j,filter);
- // ct++;
- // }
- // else{
- // slc.options[j].selected = true;
- // }
- slc.options[j].selected = true;
- } //if
- } //for j
- }
- //checklist
- else if (fltColType === this.fltTypeCheckList) {
- searcharg = _string.Str.matchCase(searcharg, this.matchCase);
- var sarg = searcharg.split(' ' + this.orOperator + ' '),
- fltValue = slc.setAttribute('value', ''),
- fltIndex = slc.setAttribute('indexes', '');
- for (var k = 0; k < _dom.Dom.tag(slc, 'li').length; k++) {
- var li = _dom.Dom.tag(slc, 'li')[k],
- lbl = _dom.Dom.tag(li, 'label')[0],
- chk = _dom.Dom.tag(li, 'input')[0],
- lblTxt = _string.Str.matchCase(_dom.Dom.getText(lbl), this.matchCase);
- if (lblTxt !== '' && _array.Arr.has(sarg, lblTxt, true)) {
- chk.checked = true;
- this.Cpt.checkList.setCheckListValues(chk);
- } else {
- chk.checked = false;
- this.Cpt.checkList.setCheckListValues(chk);
- }
- }
- }
- }
- }, {
- key: 'setColWidths',
-
- /*====================================================
- - sets coluun widths in pixels
- =====================================================*/
- value: function setColWidths(rowIndex) {
- if (!this.fltGrid || !this.hasColWidth) {
- return;
- }
- var o = this,
- rIndex;
- if (rowIndex === undefined) {
- rIndex = this.tbl.rows[0].style.display != 'none' ? 0 : 1;
- } else {
- rIndex = rowIndex;
- }
- setWidths(this.tbl.rows[rIndex]);
-
- function setWidths(row) {
- if (!o && o.nbCells != o.colWidth.length) {
- return;
- }
- if (o.nbCells == row.cells.length) {
- for (var k = 0; k < o.nbCells; k++) {
- row.cells[k].style.width = o.colWidth[k];
- }
- }
- }
- }
- }, {
- key: 'enforceVisibility',
-
- /*====================================================
- - makes a row always visible
- - Note this works only if paging is false
- =====================================================*/
- value: function enforceVisibility() {
- if (this._hasGrid && this.hasVisibleRows && !this.paging) {
- for (var i = 0; i < this.visibleRows.length; i++) {
- //row index cannot be > nrows
- if (this.visibleRows[i] <= this.nbRows) {
- this.validateRow(this.visibleRows[i], true);
- }
- }
- }
- }
- }, {
- key: 'clearFilters',
- value: function clearFilters() {
- this.EvtManager(this.Evt.name.clear);
- }
- }, {
- key: '_clearFilters',
-
- /*====================================================
- - clears grid filters
- =====================================================*/
- value: function _clearFilters() {
- if (!this.fltGrid) {
- return;
- }
- if (this.onBeforeReset) {
- this.onBeforeReset.call(null, this, this.getFiltersValue());
- }
- for (var i = 0; i < this.fltIds.length; i++) {
- this.setFilterValue(i, '');
- }
- if (this.linkedFilters) {
- this.activeFilterId = '';
- this.linkFilters();
- }
- if (this.rememberPageLen) {
- _cookie.Cookie.remove(this.pgLenCookie);
- }
- if (this.rememberPageNb) {
- _cookie.Cookie.remove(this.pgNbCookie);
- }
- if (this.onAfterReset) {
- this.onAfterReset.call(null, this);
- }
- }
- }, {
- key: 'clearActiveColumns',
-
- /*====================================================
- - clears active columns header class name
- =====================================================*/
- value: function clearActiveColumns() {
- for (var i = 0; i < this.fltIds.length; i++) {
- _dom.Dom.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass);
- }
- }
- }, {
- key: 'refresh',
-
- /*====================================================
- - Re-generates filters grid
- =====================================================*/
- value: function refresh(config) {
- var configObj = !config ? this.cfg : config;
- var hasSort = this.sort;
- //sort property is set to false in order to avoid sort object
- //re-instanciation
- if (hasSort) {
- this.sort = false;
- }
- this.nbRows = this.getRowsNb(); //in case table is refreshed
- this.remove();
- window['tf_' + this.id] = new TableFilter(this.id, this.startRow, configObj);
- this.isFirstLoad = true;
- this.fltIds = [];
- this.init();
- //New tbody content needs to be referenced in sortabletable script with
- //setTBody() method
- if (hasSort) {
- //this.st = SortableTable object
- //Note this is a method of the Sortable Table 1.12 script
- //(Erik Arvidsson)
- this.st.setTBody(this.tbl.tBodies[0]);
- //finally sort property is enabled again
- this.sort = true;
- }
- }
- }, {
- key: 'linkFilters',
-
- /*====================================================
- - retrieves select, multiple and checklist filters
- - calls method repopulating filters
- =====================================================*/
- value: function linkFilters() {
- var slcA1 = this.getFiltersByType(this.fltTypeSlc, true),
- slcA2 = this.getFiltersByType(this.fltTypeMulti, true),
- slcA3 = this.getFiltersByType(this.fltTypeCheckList, true),
- slcIndex = slcA1.concat(slcA2);
- slcIndex = slcIndex.concat(slcA3);
-
- if (this.activeFilterId) {
- var activeFlt = this.activeFilterId.split('_')[0];
- activeFlt = activeFlt.split(this.prfxFlt)[1];
- var slcSelectedValue;
- for (var i = 0; i < slcIndex.length; i++) {
- var curSlc = _dom.Dom.id(this.fltIds[slcIndex[i]]);
- slcSelectedValue = this.getFilterValue(slcIndex[i]);
- if (activeFlt !== slcIndex[i] || this.paging && _array.Arr.has(slcA1, slcIndex[i]) && activeFlt === slcIndex[i] || !this.paging && (_array.Arr.has(slcA3, slcIndex[i]) || _array.Arr.has(slcA2, slcIndex[i])) || slcSelectedValue === this.displayAllText) {
-
- if (_array.Arr.has(slcA3, slcIndex[i])) {
- this.Cpt.checkList.checkListDiv[slcIndex[i]].innerHTML = '';
- } else {
- curSlc.innerHTML = '';
- }
-
- //1st option needs to be inserted
- if (this.fillSlcOnDemand) {
- var opt0 = _dom.Dom.createOpt(this.displayAllText, '');
- if (curSlc) {
- curSlc.appendChild(opt0);
- }
- }
-
- if (_array.Arr.has(slcA3, slcIndex[i])) {
- this.Cpt.checkList._build(slcIndex[i]);
- } else {
- this.Cpt.dropdown._build(slcIndex[i], true);
- }
-
- this.setFilterValue(slcIndex[i], slcSelectedValue);
- }
- } // for i
- }
- }
- }, {
- key: '_resetGrid',
-
- /*====================================================
- - Private methods
- =====================================================*/
-
- /*====================================================
- - Only used by AddGrid() method
- - Resets filtering grid bar if previously removed
- =====================================================*/
- value: function _resetGrid() {
- if (this.isFirstLoad) {
- return;
- }
-
- // grid was removed, grid row element is stored in fltGridEl property
- if (!this.gridLayout) {
- this.tbl.rows[this.filtersRowIndex].parentNode.insertBefore(this.fltGridEl, this.tbl.rows[this.filtersRowIndex]);
- }
-
- // filters are appended in external placeholders elements
- if (this.isExternalFlt) {
- for (var ct = 0; ct < this.externalFltTgtIds.length; ct++) {
- var extFlt = _dom.Dom.id(this.externalFltTgtIds[ct]);
- if (extFlt) {
- extFlt.appendChild(this.externalFltEls[ct]);
- var colFltType = this['col' + ct];
- //IE special treatment for gridLayout, appended filters are
- //empty
- if (this.gridLayout && this.externalFltEls[ct].innerHTML === '' && colFltType !== this.fltTypeInp) {
- if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) {
- this.Cpt.dropdown.build(ct);
- }
- if (colFltType === this.fltTypeCheckList) {
- this.Cpt.checkList.build(ct);
- }
- }
- }
- }
- }
-
- this.nbFilterableRows = this.getRowsNb();
- this.nbVisibleRows = this.nbFilterableRows;
- this.nbRows = this.tbl.rows.length;
- if (this.isSortEnabled) {
- this.sort = true;
- }
-
- if (this.tbl.rows[this.filtersRowIndex].innerHTML === '') {
- refreshFilters(this);
- } else {
- if (this.popUpFilters) {
- this.headersRow++;
- this.Cpt.popupFilter.buildAll();
- }
- }
-
- /*** ie bug work-around, filters need to be re-generated since row
- is empty; insertBefore method doesn't seem to work properly
- with previously generated DOM nodes modified by innerHTML ***/
- function refreshFilters(o) {
- o.tbl.deleteRow(o.filtersRowIndex);
- o.remove();
- o.fltIds = [];
- o.isFirstLoad = true;
- if (o.popUpFilters) {
- // o.RemovePopupFilters();
- o.Cpt.popupFilter.destroy();
- }
- o._AddGrid();
- }
-
- if (!this.gridLayout) {
- _dom.Dom.addClass(this.tbl, this.prfxTf);
- }
- this._hasGrid = true;
- }
- }, {
- key: '_containsStr',
-
- /*==============================================
- - Checks if data contains searched arg,
- returns a boolean
- - Params:
- - arg: searched string
- - data: data string
- - fltType: filter type (string,
- exact match by default for selects -
- optional)
- - forceMatch: boolean forcing exact
- match (optional)
- ===============================================*/
- value: function _containsStr(arg, data, fltType, forceMatch) {
- // Improved by Cedric Wartel (cwl)
- // automatic exact match for selects and special characters are now
- // filtered
- var regexp,
- modifier = this.matchCase ? 'g' : 'gi',
- exactMatch = !forceMatch ? this.exactMatch : forceMatch;
- if (exactMatch || fltType !== this.fltTypeInp && fltType) {
- regexp = new RegExp('(^\\s*)' + _string.Str.rgxEsc(arg) + '(\\s*$)', modifier);
- } else {
- regexp = new RegExp(_string.Str.rgxEsc(arg), modifier);
- }
- return regexp.test(data);
- }
- }, {
- key: 'isImported',
- value: function isImported(filePath, type) {
- var imported = false,
- importType = !type ? 'script' : type,
- attr = importType == 'script' ? 'src' : 'href',
- files = _dom.Dom.tag(doc, importType);
- for (var i = 0; i < files.length; i++) {
- if (files[i][attr] === undefined) {
- continue;
- }
- if (files[i][attr].match(filePath)) {
- imported = true;
- break;
- }
- }
- return imported;
- }
- }, {
- key: 'includeFile',
- value: function includeFile(fileId, filePath, callback, type) {
- var ftype = !type ? 'script' : type,
- imported = this.isImported(filePath, ftype);
- if (imported) {
- return;
- }
- var o = this,
- isLoaded = false,
- file,
- head = _dom.Dom.tag(doc, 'head')[0];
-
- if (_string.Str.lower(ftype) === 'link') {
- file = _dom.Dom.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]);
- } else {
- file = _dom.Dom.create('script', ['id', fileId], ['type', 'text/javascript'], ['src', filePath]);
- }
-
- //Browser <> IE onload event works only for scripts, not for stylesheets
- file.onload = file.onreadystatechange = function () {
- if (!isLoaded && (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) {
- isLoaded = true;
- if (typeof callback === 'function') {
- callback.call(null, o);
- }
- }
- };
- file.onerror = function () {
- throw new Error('TF script could not load: ' + filePath);
- };
- head.appendChild(file);
- }
- }, {
- key: 'hasGrid',
-
- /*====================================================
- - checks if table has a filter grid
- - returns a boolean
- =====================================================*/
- value: function hasGrid() {
- return this._hasGrid;
- }
- }, {
- key: 'getFiltersId',
-
- /*====================================================
- - returns an array containing filters ids
- - Note that hidden filters are also returned
- =====================================================*/
- value: function getFiltersId() {
- if (!this._hasGrid) {
- return;
- }
- return this.fltIds;
- }
- }, {
- key: 'getValidRowsIndex',
-
- /*====================================================
- - returns an array containing valid rows indexes
- (valid rows upon filtering)
- =====================================================*/
- value: function getValidRowsIndex(reCalc) {
- if (!this._hasGrid) {
- return;
- }
- if (!reCalc) {
- return this.validRowsIndex;
- }
-
- this.validRowsIndex = [];
- for (var k = this.refRow; k < this.getRowsNb(true); k++) {
- var r = this.tbl.rows[k];
- if (!this.paging) {
- if (this.getRowDisplay(r) !== 'none') {
- this.validRowsIndex.push(r.rowIndex);
- }
- } else {
- if (r.getAttribute('validRow') === 'true' || r.getAttribute('validRow') === null) {
- this.validRowsIndex.push(r.rowIndex);
- }
- }
- }
- return this.validRowsIndex;
- }
- }, {
- key: 'getFiltersRowIndex',
-
- /*====================================================
- - Returns the index of the row containing the
- filters
- =====================================================*/
- value: function getFiltersRowIndex() {
- if (!this._hasGrid) {
- return;
- }
- return this.filtersRowIndex;
- }
- }, {
- key: 'getHeadersRowIndex',
-
- /*====================================================
- - Returns the index of the headers row
- =====================================================*/
- value: function getHeadersRowIndex() {
- if (!this._hasGrid) {
- return;
- }
- return this.headersRow;
- }
- }, {
- key: 'getStartRowIndex',
-
- /*====================================================
- - Returns the index of the row from which will
- start the filtering process (1st filterable row)
- =====================================================*/
- value: function getStartRowIndex() {
- if (!this._hasGrid) {
- return;
- }
- return this.refRow;
- }
- }, {
- key: 'getLastRowIndex',
-
- /*====================================================
- - Returns the index of the last row
- =====================================================*/
- value: function getLastRowIndex() {
- if (!this._hasGrid) {
- return;
- }
- return this.nbRows - 1;
- }
- }, {
- key: 'getHeaderElement',
-
- /*====================================================
- - returns a header DOM element for a given column
- index
- =====================================================*/
- value: function getHeaderElement(colIndex) {
- var table = this.gridLayout ? this.Cpt.gridLayout.headTbl : this.tbl;
- var tHead = _dom.Dom.tag(table, 'thead');
- var headersRow = this.headersRow;
- var header;
- for (var i = 0; i < this.nbCells; i++) {
- if (i !== colIndex) {
- continue;
- }
- if (tHead.length === 0) {
- header = table.rows[headersRow].cells[i];
- }
- if (tHead.length === 1) {
- header = tHead[0].rows[headersRow].cells[i];
- }
- break;
- }
- return header;
- }
- }, {
- key: 'config',
-
- /*====================================================
- - returns the original configuration object
- =====================================================*/
- value: function config() {
- return this.cfg;
- }
- }, {
- key: 'getFilterableRowsNb',
-
- /*====================================================
- - returns the total number of rows that can be
- filtered
- =====================================================*/
- value: function getFilterableRowsNb() {
- return this.getRowsNb(false);
- }
- }]);
-
- return TableFilter;
- })();
-
- exports.TableFilter = TableFilter;
-
- function removeNbFormat(data, format) {
- if (!data) {
- return;
- }
- if (!format) {
- format = 'us';
- }
- var n = data;
- if (_string.Str.lower(format) === 'us') {
- n = +n.replace(/[^\d\.-]/g, '');
- } else {
- n = +n.replace(/[^\d\,-]/g, '').replace(',', '.');
- }
- return n;
- }
-
- // function isStylesheetImported(stylesheet){
- // var isImported = false;
- // if(!doc.styleSheets){
- // return isImported;
- // }
- // var s = doc.styleSheets,
- // regexp = new RegExp(stylesheet);
- // for(var i=0; i 0;
-
- //callback invoked just after cols manager is loaded
- this.onLoaded = _Types.Types.isFn(f.on_loaded) ? f.on_loaded : null;
- //calls function before cols manager is opened
- this.onBeforeOpen = _Types.Types.isFn(f.on_before_open) ? f.on_before_open : null;
- //calls function after cols manager is opened
- this.onAfterOpen = _Types.Types.isFn(f.on_after_open) ? f.on_after_open : null;
- //calls function before cols manager is closed
- this.onBeforeClose = _Types.Types.isFn(f.on_before_close) ? f.on_before_close : null;
- //calls function after cols manager is closed
- this.onAfterClose = _Types.Types.isFn(f.on_after_close) ? f.on_after_close : null;
-
- //calls function before col is hidden
- this.onBeforeColHidden = _Types.Types.isFn(f.on_before_col_hidden) ? f.on_before_col_hidden : null;
- //calls function after col is hidden
- this.onAfterColHidden = _Types.Types.isFn(f.on_after_col_hidden) ? f.on_after_col_hidden : null;
- //calls function before col is displayed
- this.onBeforeColDisplayed = _Types.Types.isFn(f.on_before_col_displayed) ? f.on_before_col_displayed : null;
- //calls function after col is displayed
- this.onAfterColDisplayed = _Types.Types.isFn(f.on_after_col_displayed) ? f.on_after_col_displayed : null;
-
- //Grid layout compatibility
- if (tf.gridLayout) {
- this.headersTbl = tf.Cpt.gridLayout.headTbl; //headers table
- this.headersIndex = 0; //headers index
- this.onAfterColDisplayed = function () {};
- this.onAfterColHidden = function () {};
- }
-
- //Loads extension stylesheet
- tf.includeFile(f.name + 'Style', this.path + '/' + this.stylesheet, null, 'link');
-
- this.tf = tf;
- }
-
- _createClass(ColsVisibility, [{
- key: 'toggle',
- value: function toggle(evt) {
- var tf = this.tf;
- var contDisplay = this.contEl.style.display;
- var onBeforeOpen = this.onBeforeOpen;
- var onBeforeClose = this.onBeforeClose;
- var onAfterOpen = this.onAfterOpen;
- var onAfterClose = this.onAfterClose;
-
- if (onBeforeOpen && contDisplay !== 'inline') {
- onBeforeOpen.call(null, this);
- }
- if (onBeforeClose && contDisplay === 'inline') {
- onBeforeClose.call(null, this);
- }
-
- this.contEl.style.display = contDisplay === 'inline' ? 'none' : 'inline';
-
- if (onAfterOpen && contDisplay !== 'inline') {
- onAfterOpen.call(null, this);
- }
- if (onAfterClose && contDisplay === 'inline') {
- onAfterClose.call(null, this);
- }
- }
- }, {
- key: 'checkItem',
- value: function checkItem(lbl) {
- var li = lbl.parentNode;
- if (!li || !lbl) {
- return;
- }
- var isChecked = lbl.firstChild.checked;
- var colIndex = lbl.firstChild.getAttribute('id').split('_')[1];
- colIndex = parseInt(colIndex, 10);
- if (isChecked) {
- _Dom.Dom.addClass(li, this.listSlcItemCssClass);
- } else {
- _Dom.Dom.removeClass(li, this.listSlcItemCssClass);
- }
-
- var hide = false;
- if (this.tickToHide && isChecked || !this.tickToHide && !isChecked) {
- hide = true;
- }
- this.setHidden(colIndex, hide);
- }
- }, {
- key: 'init',
- value: function init() {
- if (!this.manager) {
- return;
- }
- this.buildBtn();
- this.buildManager();
-
- this.initialized = true;
- }
- }, {
- key: 'buildBtn',
-
- /**
- * Build main button UI
- */
- value: function buildBtn() {
- var _this = this;
-
- if (this.btnEl) {
- return;
- }
- var tf = this.tf;
- var span = _Dom.Dom.create('span', ['id', this.prfx + tf.id]);
- span.className = this.spanCssClass;
-
- //Container element (rdiv or custom element)
- if (!this.btnTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.btnTgtId ? tf.rDiv : _Dom.Dom.id(this.btnTgtId);
-
- if (!this.btnTgtId) {
- var firstChild = targetEl.firstChild;
- firstChild.parentNode.insertBefore(span, firstChild);
- } else {
- targetEl.appendChild(span);
- }
-
- if (!this.btnHtml) {
- var btn = _Dom.Dom.create('a', ['href', 'javascript:;']);
- btn.className = this.btnCssClass;
- btn.title = this.extDesc;
-
- btn.innerHTML = this.btnText;
- span.appendChild(btn);
- if (!this.enableHover) {
- _Event.Event.add(btn, 'click', function (evt) {
- _this.toggle(evt);
- });
- } else {
- _Event.Event.add(btn, 'mouseover', function (evt) {
- _this.toggle(evt);
- });
- }
- } else {
- //Custom html
- span.innerHTML = this.btnHtml;
- var colVisEl = span.firstChild;
- if (!this.enableHover) {
- _Event.Event.add(colVisEl, 'click', function (evt) {
- _this.toggle(evt);
- });
- } else {
- _Event.Event.add(colVisEl, 'mouseover', function (evt) {
- _this.toggle(evt);
- });
- }
- }
-
- this.spanEl = span;
- this.btnEl = this.spanEl.firstChild;
-
- if (this.onLoaded) {
- this.onLoaded.call(null, this);
- }
- }
- }, {
- key: 'buildManager',
-
- /**
- * Build columns manager UI
- */
- value: function buildManager() {
- var _this2 = this;
-
- var tf = this.tf;
-
- var container = !this.contElTgtId ? _Dom.Dom.create('div', ['id', this.prfxCont + tf.id]) : _Dom.Dom.id(this.contElTgtId);
- container.className = this.contCssClass;
-
- //Extension description
- var extNameLabel = _Dom.Dom.create('p');
- extNameLabel.innerHTML = this.text;
- container.appendChild(extNameLabel);
-
- //Headers list
- var ul = _Dom.Dom.create('ul', ['id', 'ul' + this.extName + '_' + tf.id]);
- ul.className = this.listCssClass;
-
- var tbl = this.headersTbl ? this.headersTbl : tf.tbl;
- var headerIndex = this.headersTbl ? this.headersIndex : tf.getHeadersRowIndex();
- var headerRow = tbl.rows[headerIndex];
-
- //Tick all option
- if (this.enableTickAll) {
- var li = _Dom.Dom.createCheckItem('col__' + tf.id, this.tickAllText, this.tickAllText);
- _Dom.Dom.addClass(li, this.listItemCssClass);
- ul.appendChild(li);
- li.check.checked = !this.tickToHide;
-
- _Event.Event.add(li.check, 'click', function (evt) {
- for (var h = 0; h < headerRow.cells.length; h++) {
- var itm = _Dom.Dom.id('col_' + h + '_' + tf.id);
- if (itm && li.check.checked !== itm.checked) {
- itm.click();
- itm.checked = li.check.checked;
- }
- }
- });
- }
-
- for (var i = 0; i < headerRow.cells.length; i++) {
- var cell = headerRow.cells[i];
- var cellText = this.headersText && this.headersText[i] ? this.headersText[i] : this._getHeaderText(cell);
- var liElm = _Dom.Dom.createCheckItem('col_' + i + '_' + tf.id, cellText, cellText);
- _Dom.Dom.addClass(liElm, this.listItemCssClass);
- if (!this.tickToHide) {
- _Dom.Dom.addClass(liElm, this.listSlcItemCssClass);
- }
- ul.appendChild(liElm);
- if (!this.tickToHide) {
- liElm.check.checked = true;
- }
-
- _Event.Event.add(liElm.check, 'click', function (evt) {
- var elm = _Event.Event.target(evt);
- var lbl = elm.parentNode;
- _this2.checkItem(lbl);
- });
- }
-
- //separator
- var p = _Dom.Dom.create('p', ['align', 'center']);
- var btn;
- //Close link
- if (!this.btnCloseHtml) {
- btn = _Dom.Dom.create('a', ['href', 'javascript:;']);
- btn.className = this.btnCloseCssClass;
- btn.innerHTML = this.btnCloseText;
- _Event.Event.add(btn, 'click', function (evt) {
- _this2.toggle(evt);
- });
- p.appendChild(btn);
- } else {
- p.innerHTML = this.btnCloseHtml;
- btn = p.firstChild;
- _Event.Event.add(btn, 'click', function (evt) {
- _this2.toggle(evt);
- });
- }
-
- container.appendChild(ul);
- container.appendChild(p);
-
- this.btnEl.parentNode.insertBefore(container, this.btnEl);
- this.contEl = container;
-
- if (this.atStart) {
- var a = this.atStart;
- for (var k = 0; k < a.length; k++) {
- var itm = _Dom.Dom.id('col_' + a[k] + '_' + tf.id);
- if (itm) {
- itm.click();
- }
- }
- }
- }
- }, {
- key: 'setHidden',
-
- /**
- * Hide or show specified columns
- * @param {Numner} colIndex Column index
- * @param {Boolean} hide hide column if true or show if false
- */
- value: function setHidden(colIndex, hide) {
- var tf = this.tf;
- var tbl = tf.tbl;
- var col = _Dom.Dom.tag(tbl, 'col')[colIndex];
-
- if (this.onBeforeColHidden && hide) {
- this.onBeforeColHidden.call(null, this, colIndex);
- }
- if (this.onBeforeColDisplayed && !hide) {
- this.onBeforeColDisplayed.call(null, this, colIndex);
- }
-
- this._hideCells(tbl, colIndex, hide);
- if (this.headersTbl) {
- this._hideCells(this.headersTbl, colIndex, hide);
- }
-
- var hiddenCols = this.hiddenCols;
- if (hide) {
- if (hiddenCols.indexOf(colIndex) === -1) {
- this.hiddenCols.push(colIndex);
- }
- } else {
- var itemIndex = _Arr.Arr.indexByValue(hiddenCols, colIndex, true);
- if (hiddenCols.indexOf(colIndex) !== -1) {
- this.hiddenCols.splice(itemIndex, 1);
- }
- }
-
- var gridLayout;
- var headTbl;
- var gridColElms;
- if (this.onAfterColHidden && hide) {
- //This event is fired just after a column is displayed for
- //grid_layout compatibility
- if (tf.gridLayout) {
- gridLayout = tf.Cpt.gridLayout;
- headTbl = gridLayout.headTbl;
- gridColElms = gridLayout.gridColElms;
- if (_Helpers.Helpers.isIE()) {
- tbl.style.width = headTbl.clientWidth + 'px';
- } else {
- var ths = headTbl.rows[this.headersIndex].cells;
- var hiddenWidth = 0;
- for (var i = 0; i < tf.nbCells; i++) {
- if (ths[i].style.display === 'none') {
- var w = parseInt(ths[i].style.width, 10);
- ths[i].style.width = 0;
- hiddenWidth += w;
- }
- }
- var headTblW = parseInt(headTbl.style.width, 10);
-
- headTbl.style.width = headTblW - hiddenWidth + 'px';
- tbl.style.width = headTbl.style.width;
- gridColElms[colIndex].style.display = 'none';
- }
- }
- this.onAfterColHidden.call(null, this, colIndex);
- }
-
- if (this.onAfterColDisplayed && !hide) {
- //This event is fired just after a column is displayed for
- //grid_layout compatibility
- if (tf.gridLayout) {
- gridLayout = tf.Cpt.gridLayout;
- headTbl = gridLayout.headTbl;
- gridColElms = gridLayout.gridColElms;
- gridColElms[colIndex].style.display = '';
- var width = parseInt(gridColElms[colIndex].style.width, 10);
- var header = tf.getHeaderElement(colIndex);
- header.style.width = width + 'px';
- headTbl.style.width = parseInt(headTbl.style.width, 10) + width + 'px';
- tf.tbl.style.width = headTbl.style.width;
- }
- this.onAfterColDisplayed.call(null, this, colIndex);
- }
- }
- }, {
- key: 'showCol',
-
- /**
- * Show specified column
- * @param {Number} colIndex Column index
- */
- value: function showCol(colIndex) {
- if (colIndex === undefined || !this.isColHidden(colIndex)) {
- return;
- }
- if (this.manager && this.contEl) {
- var itm = _Dom.Dom.id('col_' + colIndex + '_' + this.tf.id);
- if (itm) {
- itm.click();
- }
- } else {
- this.setHidden(colIndex, false);
- }
- }
- }, {
- key: 'hideCol',
-
- /**
- * Hide specified column
- * @param {Number} colIndex Column index
- */
- value: function hideCol(colIndex) {
- if (colIndex === undefined || this.isColHidden(colIndex)) {
- return;
- }
- if (this.manager && this.contEl) {
- var itm = _Dom.Dom.id('col_' + colIndex + '_' + this.tf.id);
- if (itm) {
- itm.click();
- }
- } else {
- this.setHidden(colIndex, true);
- }
- }
- }, {
- key: 'isColHidden',
-
- /**
- * Determine if specified column is hidden
- * @param {Number} colIndex Column index
- */
- value: function isColHidden(colIndex) {
- if (this.hiddenCols.indexOf(colIndex) !== -1) {
- return true;
- }
- return false;
- }
- }, {
- key: 'toggleCol',
-
- /**
- * Toggle visibility of specified column
- * @param {Number} colIndex Column index
- */
- value: function toggleCol(colIndex) {
- if (colIndex === undefined || this.isColHidden(colIndex)) {
- this.showCol(colIndex);
- } else {
- this.hideCol(colIndex);
- }
- }
- }, {
- key: 'getHiddenCols',
-
- /**
- * Returns the indexes of the columns currently hidden
- * @return {Array} column indexes
- */
- value: function getHiddenCols() {
- return this.hiddenCols;
- }
- }, {
- key: 'destroy',
-
- /**
- * Remove the columns manager
- */
- value: function destroy() {
- if (!this.btnEl || !this.contEl) {
- return;
- }
- if (_Dom.Dom.id(this.contElTgtId)) {
- _Dom.Dom.id(this.contElTgtId).innerHTML = '';
- } else {
- this.contEl.innerHTML = '';
- this.contEl.parentNode.removeChild(this.contEl);
- this.contEl = null;
- }
- this.btnEl.innerHTML = '';
- this.btnEl.parentNode.removeChild(this.btnEl);
- this.btnEl = null;
- this.initialized = false;
- }
- }, {
- key: '_getHeaderText',
- value: function _getHeaderText(cell) {
- if (!cell.hasChildNodes) {
- return '';
- }
-
- for (var i = 0; i < cell.childNodes.length; i++) {
- var n = cell.childNodes[i];
- if (n.nodeType === 3) {
- return n.nodeValue;
- } else if (n.nodeType === 1) {
- if (n.id && n.id.indexOf('popUp') !== -1) {
- continue;
- } else {
- return _Dom.Dom.getText(n);
- }
- }
- continue;
- }
- return '';
- }
- }, {
- key: '_hideCells',
- value: function _hideCells(tbl, colIndex, hide) {
- for (var i = 0; i < tbl.rows.length; i++) {
- var row = tbl.rows[i];
- var cell = row.cells[colIndex];
- if (cell) {
- cell.style.display = hide ? 'none' : '';
- }
- }
- }
- }]);
-
- return ColsVisibility;
- })();
-
- exports['default'] = ColsVisibility;
- module.exports = exports['default'];
-
-/***/ },
-
-/***/ 26:
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Types = __webpack_require__(6);
-
- var _Dom = __webpack_require__(3);
-
- var _Arr = __webpack_require__(7);
-
- var _Event = __webpack_require__(2);
-
- var _DateHelper = __webpack_require__(9);
-
- var _Helpers = __webpack_require__(8);
-
- __webpack_require__(27);
-
- var AdapterSortableTable = (function () {
-
- /**
- * SortableTable Adapter module
- * @param {Object} tf TableFilter instance
- */
-
- function AdapterSortableTable(tf) {
- _classCallCheck(this, AdapterSortableTable);
-
- // Configuration object
- var f = tf.config();
-
- this.isPaged = false;
-
- //indicates if tables was sorted
- this.sorted = false;
-
- // edit .sort-arrow.descending / .sort-arrow.ascending in filtergrid.css
- // to reflect any path change
- this.sortImgPath = f.sort_images_path || tf.themesPath;
- this.sortImgBlank = f.sort_image_blank || 'blank.png';
- this.sortImgClassName = f.sort_image_class_name || 'sort-arrow';
- this.sortImgAscClassName = f.sort_image_asc_class_name || 'ascending';
- this.sortImgDescClassName = f.sort_image_desc_class_name || 'descending';
- //cell attribute storing custom key
- this.sortCustomKey = f.sort_custom_key || 'data-tf-sortKey';
-
- /*** TF additional events ***/
- //additional paging events for alternating background
- // o.Evt._Paging.nextEvt = function(){ if(o.sorted && o.alternateBgs) o.Filter(); }
- // o.Evt._Paging.prevEvt = o.Evt._Paging.nextEvt;
- // o.Evt._Paging.firstEvt = o.Evt._Paging.nextEvt;
- // o.Evt._Paging.lastEvt = o.Evt._Paging.nextEvt;
- // o.Evt._OnSlcPagesChangeEvt = o.Evt._Paging.nextEvt;
-
- // callback invoked after sort is loaded and instanciated
- this.onSortLoaded = _Types.Types.isFn(f.on_sort_loaded) ? f.on_sort_loaded : null;
- // callback invoked before table is sorted
- this.onBeforeSort = _Types.Types.isFn(f.on_before_sort) ? f.on_before_sort : null;
- // callback invoked after table is sorted
- this.onAfterSort = _Types.Types.isFn(f.on_after_sort) ? f.on_after_sort : null;
-
- this.tf = tf;
- }
-
- _createClass(AdapterSortableTable, [{
- key: 'init',
- value: function init() {
- var tf = this.tf;
- var sortConfig = tf.sortConfig;
- var adpt = this;
-
- // SortableTable class sanity check (sortabletable.js)
- if (_Types.Types.isUndef(SortableTable)) {
- throw new Error('SortableTable class not found.');
- }
-
- this.overrideSortableTable();
- this.setSortTypes();
-
- //Column sort at start
- if (sortConfig.sortCol) {
- this.stt.sort(sortConfig.sortCol[0], sortConfig.sortCol[1]);
- }
-
- tf.isSortEnabled = true;
- if (this.onSortLoaded) {
- this.onSortLoaded.call(null, tf, this);
- }
-
- /*** SortableTable callbacks ***/
- this.stt.onbeforesort = function () {
- if (this.onBeforeSort) {
- this.onBeforeSort.call(null, tf, this.stt.sortColumn);
- }
-
- tf.performSort();
-
- /*** sort behaviour for paging ***/
- if (tf.paging) {
- adpt.isPaged = true;
- tf.paging = false;
- tf.Cpt.paging.destroy();
- }
- };
-
- this.stt.onsort = function () {
- adpt.sorted = true;
-
- //rows alternating bg issue
- // TODO: move into AlternateRows component
- if (tf.alternateBgs) {
- var rows = tf.tbl.rows,
- c = 0;
-
- var setClass = function setClass(row, i, removeOnly) {
- if (_Types.Types.isUndef(removeOnly)) {
- removeOnly = false;
- }
- var altRows = tf.Cpt.alternateRows,
- oddCls = altRows.oddCss,
- evenCls = altRows.evenCss;
- _Dom.Dom.removeClass(row, oddCls);
- _Dom.Dom.removeClass(row, evenCls);
-
- if (!removeOnly) {
- _Dom.Dom.addClass(row, i % 2 ? oddCls : evenCls);
- }
- };
-
- for (var i = tf.refRow; i < tf.nbRows; i++) {
- var isRowValid = rows[i].getAttribute('validRow');
- if (tf.paging && rows[i].style.display === '') {
- setClass(rows[i], c);
- c++;
- } else {
- if ((isRowValid === 'true' || isRowValid === null) && rows[i].style.display === '') {
- setClass(rows[i], c);
- c++;
- } else {
- setClass(rows[i], c, true);
- }
- }
- }
- }
- //sort behaviour for paging
- if (adpt.isPaged) {
- var paginator = tf.Cpt.paging,
- config = tf.config();
- if (paginator.hasResultsPerPage) {
- var slc = paginator.resultsPerPageSlc;
- config.paging_length = slc.options[slc.selectedIndex].value;
- }
- paginator.addPaging(false);
- paginator.setPage(paginator.currentPageNb);
- adpt.isPaged = false;
- }
-
- if (adpt.onAfterSort) {
- adpt.onAfterSort.call(null, tf, tf.stt.sortColumn);
- }
- };
- }
- }, {
- key: 'sortByColumnIndex',
-
- /**
- * Sort specified column
- * @param {Number} colIdx Column index
- */
- value: function sortByColumnIndex(colIdx) {
- this.stt.sort(colIdx);
- }
- }, {
- key: 'overrideSortableTable',
- value: function overrideSortableTable() {
- var adpt = this,
- tf = this.tf;
-
- /**
- * Overrides headerOnclick method in order to handle th event
- * @param {Object} e [description]
- */
- SortableTable.prototype.headerOnclick = function (evt) {
- if (!tf.sort) {
- return;
- }
- // find Header element
- var el = evt.target || evt.srcElement;
-
- while (el.tagName !== 'TD' && el.tagName !== 'TH') {
- el = el.parentNode;
- }
-
- this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);
- };
-
- /**
- * Overrides getCellIndex IE returns wrong cellIndex when columns are
- * hidden
- * @param {Object} oTd TD element
- * @return {Number} Cell index
- */
- SortableTable.getCellIndex = function (oTd) {
- var cells = oTd.parentNode.cells,
- l = cells.length,
- i;
- for (i = 0; cells[i] != oTd && i < l; i++) {}
- return i;
- };
-
- /**
- * Overrides initHeader in order to handle filters row position
- * @param {Array} oSortTypes
- */
- SortableTable.prototype.initHeader = function (oSortTypes) {
- var stt = this;
- if (!stt.tHead) {
- // throw new Error('Sorting feature requires a THEAD element');
- return;
- }
- stt.headersRow = tf.headersRow;
- var cells = stt.tHead.rows[stt.headersRow].cells;
- var doc = stt.tHead.ownerDocument || stt.tHead.document;
- stt.sortTypes = oSortTypes || [];
- var l = cells.length;
- var img, c;
- for (var i = 0; i < l; i++) {
- c = cells[i];
- if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None') {
- c.style.cursor = 'pointer';
- img = _Dom.Dom.create('img', ['src', adpt.sortImgPath + adpt.sortImgBlank]);
- c.appendChild(img);
- if (stt.sortTypes[i] !== null) {
- c.setAttribute('_sortType', stt.sortTypes[i]);
- }
- _Event.Event.add(c, 'click', stt._headerOnclick);
- } else {
- c.setAttribute('_sortType', oSortTypes[i]);
- c._sortType = 'None';
- }
- }
- stt.updateHeaderArrows();
- };
-
- /**
- * Overrides updateHeaderArrows in order to handle arrows indicators
- */
- SortableTable.prototype.updateHeaderArrows = function () {
- var stt = this;
- var cells, l, img;
- // external headers
- if (tf.sortConfig.asyncSort && tf.sortConfig.triggerIds !== null) {
- var triggers = tf.sortConfig.triggerIds;
- cells = [];
- l = triggers.length;
- for (var j = 0; j < triggers.length; j++) {
- cells.push(_Dom.Dom.id(triggers[j]));
- }
- } else {
- if (!this.tHead) {
- return;
- }
- cells = stt.tHead.rows[stt.headersRow].cells;
- l = cells.length;
- }
- for (var i = 0; i < l; i++) {
- var cellAttr = cells[i].getAttribute('_sortType');
- if (cellAttr !== null && cellAttr !== 'None') {
- img = cells[i].lastChild || cells[i];
- if (img.nodeName.toLowerCase() !== 'img') {
- img = _Dom.Dom.create('img', ['src', adpt.sortImgPath + adpt.sortImgBlank]);
- cells[i].appendChild(img);
- }
- if (i === stt.sortColumn) {
- img.className = adpt.sortImgClassName + ' ' + (this.descending ? adpt.sortImgDescClassName : adpt.sortImgAscClassName);
- } else {
- img.className = adpt.sortImgClassName;
- }
- }
- }
- };
-
- /**
- * Overrides getRowValue for custom key value feature
- * @param {Object} oRow Row element
- * @param {String} sType
- * @param {Number} nColumn
- * @return {String}
- */
- SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {
- var stt = this;
- // if we have defined a custom getRowValue use that
- var sortTypeInfo = stt._sortTypeInfo[sType];
- if (sortTypeInfo && sortTypeInfo.getRowValue) {
- return sortTypeInfo.getRowValue(oRow, nColumn);
- }
- var c = oRow.cells[nColumn];
- var s = SortableTable.getInnerText(c);
- return stt.getValueFromString(s, sType);
- };
-
- /**
- * Overrides getInnerText in order to avoid Firefox unexpected sorting
- * behaviour with untrimmed text elements
- * @param {Object} oNode DOM element
- * @return {String} DOM element inner text
- */
- SortableTable.getInnerText = function (oNode) {
- if (!oNode) {
- return;
- }
- if (oNode.getAttribute(adpt.sortCustomKey)) {
- return oNode.getAttribute(adpt.sortCustomKey);
- } else {
- return _Dom.Dom.getText(oNode);
- }
- };
- }
- }, {
- key: 'addSortType',
- value: function addSortType() {
- SortableTable.prototype.addSortType(arguments[0], arguments[1], arguments[2], arguments[3]);
- }
- }, {
- key: 'setSortTypes',
- value: function setSortTypes() {
- var _this = this;
-
- var tf = this.tf,
- configSort = tf.sortConfig,
- configSortTypes = configSort.sortTypes,
- sortTypes = [];
-
- for (var i = 0; i < tf.nbCells; i++) {
- var colType;
-
- if (configSortTypes !== null && configSortTypes[i] != null) {
- colType = configSortTypes[i].toLowerCase();
- if (colType === 'none') {
- colType = 'None';
- }
- } else {
- // resolve column types
- if (tf.hasColNbFormat && tf.colNbFormat[i] !== null) {
- colType = tf.colNbFormat[i].toLowerCase();
- } else if (tf.hasColDateType && tf.colDateType[i] !== null) {
- colType = tf.colDateType[i].toLowerCase() + 'date';
- } else {
- colType = 'String';
- }
- }
- sortTypes.push(colType);
- }
-
- //Public TF method to add sort type
-
- //Custom sort types
- this.addSortType('number', Number);
- this.addSortType('caseinsensitivestring', SortableTable.toUpperCase);
- this.addSortType('date', SortableTable.toDate);
- this.addSortType('string');
- this.addSortType('us', usNumberConverter);
- this.addSortType('eu', euNumberConverter);
- this.addSortType('dmydate', dmyDateConverter);
- this.addSortType('ymddate', ymdDateConverter);
- this.addSortType('mdydate', mdyDateConverter);
- this.addSortType('ddmmmyyyydate', ddmmmyyyyDateConverter);
- this.addSortType('ipaddress', ipAddress, sortIP);
-
- this.stt = new SortableTable(tf.tbl, sortTypes);
-
- /*** external table headers adapter ***/
- if (configSort.asyncSort && configSort.triggerIds !== null) {
- var triggers = configSort.triggerIds;
- for (var j = 0; j < triggers.length; j++) {
- if (triggers[j] === null) {
- continue;
- }
- var trigger = _Dom.Dom.id(triggers[j]);
- if (trigger) {
- trigger.style.cursor = 'pointer';
-
- _Event.Event.add(trigger, 'click', function (evt) {
- var elm = evt.target;
- if (!_this.tf.sort) {
- return;
- }
- _this.stt.asyncSort(_Arr.Arr.indexByValue(triggers, elm.id, true));
- });
- trigger.setAttribute('_sortType', sortTypes[j]);
- }
- }
- }
- }
- }, {
- key: 'destroy',
-
- /**
- * Destroy sort
- */
- value: function destroy() {
- var tf = this.tf;
- tf.sort = false;
- this.sorted = false;
- this.stt.destroy();
-
- var ids = tf.getFiltersId();
- for (var idx = 0; idx < ids.length; idx++) {
- var header = tf.getHeaderElement(idx);
- var img = _Dom.Dom.tag(header, 'img');
-
- if (img.length === 1) {
- header.removeChild(img[0]);
- }
- }
- }
- }]);
-
- return AdapterSortableTable;
- })();
-
- exports['default'] = AdapterSortableTable;
-
- //Converters
- function usNumberConverter(s) {
- return _Helpers.Helpers.removeNbFormat(s, 'us');
- }
- function euNumberConverter(s) {
- return _Helpers.Helpers.removeNbFormat(s, 'eu');
- }
- function dateConverter(s, format) {
- return _DateHelper.DateHelper.format(s, format);
- }
- function dmyDateConverter(s) {
- return dateConverter(s, 'DMY');
- }
- function mdyDateConverter(s) {
- return dateConverter(s, 'MDY');
- }
- function ymdDateConverter(s) {
- return dateConverter(s, 'YMD');
- }
- function ddmmmyyyyDateConverter(s) {
- return dateConverter(s, 'DDMMMYYYY');
- }
-
- function ipAddress(value) {
- var vals = value.split('.');
- for (var x in vals) {
- var val = vals[x];
- while (3 > val.length) {
- val = '0' + val;
- }
- vals[x] = val;
- }
- return vals.join('.');
- }
-
- function sortIP(a, b) {
- var aa = ipAddress(a.value.toLowerCase());
- var bb = ipAddress(b.value.toLowerCase());
- if (aa == bb) {
- return 0;
- } else if (aa < bb) {
- return -1;
- } else {
- return 1;
- }
- }
- module.exports = exports['default'];
-
-/***/ },
-
-/***/ 27:
-/***/ function(module, exports, __webpack_require__) {
-
- __webpack_require__(28)(__webpack_require__(29))
-
-/***/ },
-
-/***/ 28:
-/***/ function(module, exports, __webpack_require__) {
-
- /*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
- */
- module.exports = function(src) {
- if (typeof execScript === "function")
- execScript(src);
- else
- eval.call(null, src);
- }
-
-/***/ },
-
-/***/ 29:
-/***/ function(module, exports, __webpack_require__) {
-
- module.exports = "/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the \"License\"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n\tthis.sortTypes = oSortTypes || [];\r\n\r\n\tthis.sortColumn = null;\r\n\tthis.descending = null;\r\n\r\n\tvar oThis = this;\r\n\tthis._headerOnclick = function (e) {\r\n\t\toThis.headerOnclick(e);\r\n\t};\r\n\r\n\tif (oTable) {\r\n\t\tthis.setTable( oTable );\r\n\t\tthis.document = oTable.ownerDocument || oTable.document;\r\n\t}\r\n\telse {\r\n\t\tthis.document = document;\r\n\t}\r\n\r\n\r\n\t// only IE needs this\r\n\tvar win = this.document.defaultView || this.document.parentWindow;\r\n\tthis._onunload = function () {\r\n\t\toThis.destroy();\r\n\t};\r\n\tif (win && typeof win.attachEvent != \"undefined\") {\r\n\t\twin.attachEvent(\"onunload\", this._onunload);\r\n\t}\r\n}\r\n\r\nSortableTable.gecko = navigator.product == \"Gecko\";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.element = oTable;\r\n\tthis.setTHead( oTable.tHead );\r\n\tthis.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n\tif (this.tHead && this.tHead != oTHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.tHead = oTHead;\r\n\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n\tthis.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n\tif ( this.tHead )\r\n\t\tthis.uninitHeader();\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tif ( this.tHead )\r\n\t\tthis.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\r\n\tthis.sortTypes = oSortTypes || [];\r\n\tvar l = cells.length;\r\n\tvar img, c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != \"None\") {\r\n\t\t\timg = doc.createElement(\"IMG\");\r\n\t\t\timg.src = \"images/blank.png\";\r\n\t\t\tc.appendChild(img);\r\n\t\t\tif (this.sortTypes[i] != null)\r\n\t\t\t\tc._sortType = this.sortTypes[i];\r\n\t\t\tif (typeof c.addEventListener != \"undefined\")\r\n\t\t\t\tc.addEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.attachEvent != \"undefined\")\r\n\t\t\t\tc.attachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\telse\r\n\t\t\t\tc.onclick = this._headerOnclick;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tc.setAttribute( \"_sortType\", oSortTypes[i] );\r\n\t\t\tc._sortType = \"None\";\r\n\t\t}\r\n\t}\r\n\tthis.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar c;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tc = cells[i];\r\n\t\tif (c._sortType != null && c._sortType != \"None\") {\r\n\t\t\tc.removeChild(c.lastChild);\r\n\t\t\tif (typeof c.removeEventListener != \"undefined\")\r\n\t\t\t\tc.removeEventListener(\"click\", this._headerOnclick, false);\r\n\t\t\telse if (typeof c.detachEvent != \"undefined\")\r\n\t\t\t\tc.detachEvent(\"onclick\", this._headerOnclick);\r\n\t\t\tc._sortType = null;\r\n\t\t\tc.removeAttribute( \"_sortType\" );\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n\tif (!this.tHead) return;\r\n\tvar cells = this.tHead.rows[0].cells;\r\n\tvar l = cells.length;\r\n\tvar img;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != \"None\") {\r\n\t\t\timg = cells[i].lastChild;\r\n\t\t\tif (i == this.sortColumn)\r\n\t\t\t\timg.className = \"sort-arrow \" + (this.descending ? \"descending\" : \"ascending\");\r\n\t\t\telse\r\n\t\t\t\timg.className = \"sort-arrow\";\r\n\t\t}\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n\t// find TD element\r\n\tvar el = e.target || e.srcElement;\r\n\twhile (el.tagName != \"TD\")\r\n\t\tel = el.parentNode;\r\n\r\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n\tvar cells = oTd.parentNode.childNodes\r\n\tvar l = cells.length;\r\n\tvar i;\r\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\r\n\t\t;\r\n\treturn i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n\treturn this.sortTypes[nColumn] || \"String\";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n\tif (!this.tBody) return;\r\n\tif (sSortType == null)\r\n\t\tsSortType = this.getSortType(nColumn);\r\n\r\n\t// exit if None\r\n\tif (sSortType == \"None\")\r\n\t\treturn;\r\n\r\n\tif (bDescending == null) {\r\n\t\tif (this.sortColumn != nColumn)\r\n\t\t\tthis.descending = this.defaultDescending;\r\n\t\telse\r\n\t\t\tthis.descending = !this.descending;\r\n\t}\r\n\telse\r\n\t\tthis.descending = bDescending;\r\n\r\n\tthis.sortColumn = nColumn;\r\n\r\n\tif (typeof this.onbeforesort == \"function\")\r\n\t\tthis.onbeforesort();\r\n\r\n\tvar f = this.getSortFunction(sSortType, nColumn);\r\n\tvar a = this.getCache(sSortType, nColumn);\r\n\tvar tBody = this.tBody;\r\n\r\n\ta.sort(f);\r\n\r\n\tif (this.descending)\r\n\t\ta.reverse();\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// remove from doc\r\n\t\tvar nextSibling = tBody.nextSibling;\r\n\t\tvar p = tBody.parentNode;\r\n\t\tp.removeChild(tBody);\r\n\t}\r\n\r\n\t// insert in the new order\r\n\tvar l = a.length;\r\n\tfor (var i = 0; i < l; i++)\r\n\t\ttBody.appendChild(a[i].element);\r\n\r\n\tif (SortableTable.removeBeforeSort) {\r\n\t\t// insert into doc\r\n\t\tp.insertBefore(tBody, nextSibling);\r\n\t}\r\n\r\n\tthis.updateHeaderArrows();\r\n\r\n\tthis.destroyCache(a);\r\n\r\n\tif (typeof this.onsort == \"function\")\r\n\t\tthis.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n\tvar oThis = this;\r\n\tthis._asyncsort = function () {\r\n\t\toThis.sort(nColumn, bDescending, sSortType);\r\n\t};\r\n\twindow.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n\tif (!this.tBody) return [];\r\n\tvar rows = this.tBody.rows;\r\n\tvar l = rows.length;\r\n\tvar a = new Array(l);\r\n\tvar r;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tr = rows[i];\r\n\t\ta[i] = {\r\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\r\n\t\t\telement:\tr\r\n\t\t};\r\n\t};\r\n\treturn a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n\tvar l = oArray.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\toArray[i].value = null;\r\n\t\toArray[i].element = null;\r\n\t\toArray[i] = null;\r\n\t}\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n\t// if we have defined a custom getRowValue use that\r\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n\tvar s;\r\n\tvar c = oRow.cells[nColumn];\r\n\tif (typeof c.innerText != \"undefined\")\r\n\t\ts = c.innerText;\r\n\telse\r\n\t\ts = SortableTable.getInnerText(c);\r\n\treturn this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n\tvar s = \"\";\r\n\tvar cs = oNode.childNodes;\r\n\tvar l = cs.length;\r\n\tfor (var i = 0; i < l; i++) {\r\n\t\tswitch (cs[i].nodeType) {\r\n\t\t\tcase 1: //ELEMENT_NODE\r\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\t//TEXT_NODE\r\n\t\t\t\ts += cs[i].nodeValue;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\r\n\treturn sText;\r\n\t/*\r\n\tswitch (sType) {\r\n\t\tcase \"Number\":\r\n\t\t\treturn Number(sText);\r\n\t\tcase \"CaseInsensitiveString\":\r\n\t\t\treturn sText.toUpperCase();\r\n\t\tcase \"Date\":\r\n\t\t\tvar parts = sText.split(\"-\");\r\n\t\t\tvar d = new Date(0);\r\n\t\t\td.setFullYear(parts[0]);\r\n\t\t\td.setDate(parts[2]);\r\n\t\t\td.setMonth(parts[1] - 1);\r\n\t\t\treturn d.valueOf();\r\n\t}\r\n\treturn sText;\r\n\t*/\r\n\t};\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n\tif (this._sortTypeInfo[sType])\r\n\t\treturn this._sortTypeInfo[sType].compare;\r\n\treturn SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n\tthis.uninitHeader();\r\n\tvar win = this.document.parentWindow;\r\n\tif (win && typeof win.detachEvent != \"undefined\") {\t// only IE needs this\r\n\t\twin.detachEvent(\"onunload\", this._onunload);\r\n\t}\r\n\tthis._onunload = null;\r\n\tthis.element = null;\r\n\tthis.tHead = null;\r\n\tthis.tBody = null;\r\n\tthis.document = null;\r\n\tthis._headerOnclick = null;\r\n\tthis.sortTypes = null;\r\n\tthis._asyncsort = null;\r\n\tthis.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n\tthis._sortTypeInfo[sType] = {\r\n\t\ttype:\t\t\t\tsType,\r\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\r\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\r\n\t\tgetRowValue:\t\tfGetRowValue\r\n\t};\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n\tdelete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n\tif (n1.value < n2.value)\r\n\t\treturn -1;\r\n\tif (n2.value < n1.value)\r\n\t\treturn 1;\r\n\treturn 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n\treturn x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n\treturn s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n\tvar parts = s.split(\"-\");\r\n\tvar d = new Date(0);\r\n\td.setFullYear(parts[0]);\r\n\td.setDate(parts[2]);\r\n\td.setMonth(parts[1] - 1);\r\n\treturn d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType(\"Number\", Number);\r\nSortableTable.prototype.addSortType(\"CaseInsensitiveString\", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType(\"Date\", SortableTable.toDate);\r\nSortableTable.prototype.addSortType(\"String\");\r\n// None is a special case\r\n"
-
-/***/ }
-
-});
\ No newline at end of file
diff --git a/dist/tablefilter.js b/dist/tablefilter.js
deleted file mode 100644
index 2577f837..00000000
--- a/dist/tablefilter.js
+++ /dev/null
@@ -1,7887 +0,0 @@
-(function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define(factory);
- else {
- var a = factory();
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
- }
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // install a JSONP callback for chunk loading
-/******/ var parentJsonpFunction = window["webpackJsonp"];
-/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
-/******/ // add "moreModules" to the modules object,
-/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, callbacks = [];
-/******/ for(;i < chunkIds.length; i++) {
-/******/ chunkId = chunkIds[i];
-/******/ if(installedChunks[chunkId])
-/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]);
-/******/ installedChunks[chunkId] = 0;
-/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ modules[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);
-/******/ while(callbacks.length)
-/******/ callbacks.shift().call(null, __webpack_require__);
-
-/******/ };
-
-/******/ // The module cache
-/******/ var installedModules = {};
-
-/******/ // object to store loaded and loading chunks
-/******/ // "0" means "already loaded"
-/******/ // Array means "loading", array contains callbacks
-/******/ var installedChunks = {
-/******/ 0:0
-/******/ };
-
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
-
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
-
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
-
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-
-/******/ // This file contains only the entry chunk.
-/******/ // The chunk loading function for additional chunks
-/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) {
-/******/ // "0" is the signal for "already loaded"
-/******/ if(installedChunks[chunkId] === 0)
-/******/ return callback.call(null, __webpack_require__);
-
-/******/ // an array means "currently loading".
-/******/ if(installedChunks[chunkId] !== undefined) {
-/******/ installedChunks[chunkId].push(callback);
-/******/ } else {
-/******/ // start chunk loading
-/******/ installedChunks[chunkId] = [callback];
-/******/ var head = document.getElementsByTagName('head')[0];
-/******/ var script = document.createElement('script');
-/******/ script.type = 'text/javascript';
-/******/ script.charset = 'utf-8';
-/******/ script.async = true;
-
-/******/ script.src = __webpack_require__.p + "" + ({}[chunkId]||chunkId) + ".js";
-/******/ head.appendChild(script);
-/******/ }
-/******/ };
-
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "/dist/";
-
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- /* ------------------------------------------------------------------------
- - HTML Table Filter Generator v3.0
- - By Max Guglielmi (tablefilter.free.fr)
- - Licensed under the MIT License
- ---------------------------------------------------------------------------
- - Special credit to:
- Cedric Wartel, cnx.claude@free.fr, Florent Hirchy, Váry Péter,
- Anthony Maes, Nuovella Williams, Fuggerbit, Venkata Seshagiri Rao
- Raya, Piepiax, Manuel Kern, Baladhandayutham for active contribution
- and/or inspiration
- ------------------------------------------------------------------------ */
-
- var _evt = __webpack_require__(2);
-
- var _dom = __webpack_require__(3);
-
- var _str = __webpack_require__(4);
-
- var _cookie = __webpack_require__(5);
-
- var _types = __webpack_require__(6);
-
- var _array = __webpack_require__(7);
-
- var _hlp = __webpack_require__(8);
-
- var _dateHelper = __webpack_require__(9);
-
- var _Sort = __webpack_require__(10);
-
- // Modules
-
- var _Store = __webpack_require__(11);
-
- var _GridLayout = __webpack_require__(12);
-
- var _Loader = __webpack_require__(13);
-
- var _HighlightKeyword = __webpack_require__(14);
-
- var _PopupFilter = __webpack_require__(15);
-
- var _Dropdown = __webpack_require__(16);
-
- var _CheckList = __webpack_require__(17);
-
- var _RowsCounter = __webpack_require__(18);
-
- var _StatusBar = __webpack_require__(19);
-
- var _Paging = __webpack_require__(20);
-
- var _ClearButton = __webpack_require__(21);
-
- var _Help = __webpack_require__(22);
-
- var _AlternateRows = __webpack_require__(23);
-
- var _ColOps = __webpack_require__(24);
-
- var global = window,
- isValidDate = _dateHelper.DateHelper.isValid,
- formatDate = _dateHelper.DateHelper.format,
- doc = global.document;
-
- var TableFilter = (function () {
-
- /**
- * TF object constructor
- * @param {String} id Table id
- * @param {Number} row index indicating the 1st row
- * @param {Object} configuration object
- */
-
- function TableFilter(id) {
- _classCallCheck(this, TableFilter);
-
- if (arguments.length === 0) {
- return;
- }
-
- this.id = id;
- this.version = '3.0';
- this.year = new Date().getFullYear();
- this.tbl = _dom.Dom.id(id);
- this.startRow = null;
- this.refRow = null;
- this.headersRow = null;
- this.cfg = {};
- this.nbFilterableRows = null;
- this.nbRows = null;
- this.nbCells = null;
- this._hasGrid = false;
- this.enableModules = false;
-
- if (!this.tbl || _str.Str.lower(this.tbl.nodeName) !== 'table' || this.getRowsNb() === 0) {
- throw new Error('Could not instantiate TableFilter class: ' + 'HTML table not found.');
- }
-
- if (arguments.length > 1) {
- for (var i = 0; i < arguments.length; i++) {
- var arg = arguments[i];
- var argtype = typeof arg;
- switch (_str.Str.lower(argtype)) {
- case 'number':
- this.startRow = arg;
- break;
- case 'object':
- this.cfg = arg;
- break;
- }
- }
- }
-
- // configuration object
- var f = this.cfg;
-
- //Start row et cols nb
- this.refRow = this.startRow === null ? 2 : this.startRow + 1;
- try {
- this.nbCells = this.getCellsNb(this.refRow);
- } catch (e) {
- this.nbCells = this.getCellsNb(0);
- }
-
- //default script base path
- this.basePath = f.base_path !== undefined ? f.base_path : '';
- this.extensionsPath = f.extensions_path || this.basePath + 'extensions/';
-
- /*** filter types ***/
- this.fltTypeInp = 'input';
- this.fltTypeSlc = 'select';
- this.fltTypeMulti = 'multiple';
- this.fltTypeCheckList = 'checklist';
- this.fltTypeNone = 'none';
- this.fltCol = []; //filter type of each column
-
- for (var j = 0; j < this.nbCells; j++) {
- var cfgCol = f['col_' + j];
- var col = !cfgCol ? this.fltTypeInp : _str.Str.lower(cfgCol);
- this.fltCol.push(col);
- this['col' + j] = col;
- }
-
- /*** Developer's additional methods ***/
- this.publicMethods = f.public_methods !== undefined ? f.public_methods : false;
-
- /*** filters' grid properties ***/
-
- //enables/disables filter grid
- this.fltGrid = f.grid === false ? false : true;
-
- /*** Grid layout ***/
- //enables/disables grid layout (fixed headers)
- this.gridLayout = f.grid_layout ? true : false;
- this.sourceTblHtml = null;
- if (this.gridLayout) {
- //Firefox does not support outerHTML property...
- if (this.tbl.outerHTML === undefined) {
- setOuterHtml();
- }
- this.sourceTblHtml = this.tbl.outerHTML;
- }
- /*** ***/
-
- this.filtersRowIndex = f.filters_row_index || 0;
- this.headersRow = f.headers_row_index || (this.filtersRowIndex === 0 ? 1 : 0);
-
- if (this.gridLayout) {
- if (this.headersRow > 1) {
- this.filtersRowIndex = this.headersRow + 1;
- } else {
- this.filtersRowIndex = 1;
- this.headersRow = 0;
- }
- }
-
- //defines tag of the cells containing filters (td/th)
- this.fltCellTag = f.filters_cell_tag !== 'th' || f.filters_cell_tag !== 'td' ? 'td' : f.filters_cell_tag;
-
- //stores filters ids
- this.fltIds = [];
- //stores filters DOM elements
- this.fltElms = [];
- //stores filters values
- this.searchArgs = null;
- //stores table data
- this.tblData = [];
- //stores valid rows indexes (rows visible upon filtering)
- this.validRowsIndex = null;
- //stores filters row element
- this.fltGridEl = null;
- //is first load boolean
- this.isFirstLoad = true;
- //container div for paging elements, reset btn etc.
- this.infDiv = null;
- //div for rows counter
- this.lDiv = null;
- //div for reset button and results per page select
- this.rDiv = null;
- //div for paging elements
- this.mDiv = null;
- //table container div for fixed headers (IE only)
- this.contDiv = null;
-
- //defines css class for div containing paging elements, rows counter etc.
- this.infDivCssClass = f.inf_div_css_class || 'inf';
- //defines css class for left div
- this.lDivCssClass = f.left_div_css_class || 'ldiv';
- //defines css class for right div
- this.rDivCssClass = f.right_div_css_class || 'rdiv';
- //defines css class for mid div
- this.mDivCssClass = f.middle_div_css_class || 'mdiv';
- //table container div css class
- this.contDivCssClass = f.content_div_css_class || 'cont';
-
- /*** filters' grid appearance ***/
- //stylesheet file
- this.stylesheet = f.stylesheet || this.basePath + 'filtergrid.css';
- this.stylesheetId = this.id + '_style';
- //defines css class for filters row
- this.fltsRowCssClass = f.flts_row_css_class || 'fltrow';
- //enables/disables icons (paging, reset button)
- this.enableIcons = f.enable_icons === false ? false : true;
- //enables/disbles rows alternating bg colors
- this.alternateBgs = f.alternate_rows === true ? true : false;
- //defines widths of columns
- this.hasColWidth = f.col_width === true ? true : false;
- this.colWidth = this.hasColWidth ? f.col_width : null;
- //enables/disables fixed headers
- this.fixedHeaders = f.fixed_headers === true ? true : false;
- //tbody height if fixed headers enabled
- this.tBodyH = !isNaN(f.tbody_height) ? f.tbody_height : 200;
- //defines css class for filters
- this.fltCssClass = f.flt_css_class || 'flt';
- //defines css class for multiple selects filters
- this.fltMultiCssClass = f.flt_multi_css_class || 'flt_multi';
- //defines css class for filters
- this.fltSmallCssClass = f.flt_small_css_class || 'flt_s';
- //defines css class for single-filter
- this.singleFltCssClass = f.single_flt_css_class || 'single_flt';
- this.isStartBgAlternate = true;
-
- /*** filters' grid behaviours ***/
- //enables/disables enter key
- this.enterKey = f.enter_key === false ? false : true;
- //enables/disables alternative fn call
- this.isModFilterFn = f.mod_filter_fn === true ? true : false;
- // used by tf_DetectKey fn
- this.modFilterFn = this.isModFilterFn ? f.mod_filter_fn : null;
- //calls function before filtering starts
- this.onBeforeFilter = _types.Types.isFn(f.on_before_filter) ? f.on_before_filter : null;
- //calls function after filtering
- this.onAfterFilter = _types.Types.isFn(f.on_after_filter) ? f.on_after_filter : null;
- //enables/disables case sensitivity
- this.matchCase = f.match_case === true ? true : false;
- //enables/disbles exact match for search
- this.exactMatch = f.exact_match === true ? true : false;
- //refreshes drop-down lists upon validation
- this.linkedFilters = f.linked_filters === true ? true : false;
- //wheter excluded options are disabled
- this.disableExcludedOptions = f.disable_excluded_options === true ? true : false;
- //stores active filter element
- this.activeFlt = null;
- //id of active filter
- this.activeFilterId = null;
- //enables/disbles column operation(sum,mean)
- this.hasColOperation = f.col_operation ? true : false;
- this.colOperation = null;
- //enables always visible rows
- this.hasVisibleRows = f.rows_always_visible ? true : false;
- //array containing always visible rows
- this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : [];
- //defines search type: include or exclude
- this.searchType = f.search_type || 'include';
- //enables/disables external filters generation
- this.isExternalFlt = f.external_flt_grid === true ? true : false;
- //array containing ids of external elements containing filters
- this.externalFltTgtIds = f.external_flt_grid_ids || null;
- //stores filters elements if isExternalFlt is true
- this.externalFltEls = [];
- //delays any filtering process if loader true
- this.execDelay = !isNaN(f.exec_delay) ? parseInt(f.exec_delay, 10) : 100;
- //calls function when filters grid loaded
- this.onFiltersLoaded = _types.Types.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null;
- //enables/disables single filter search
- this.singleSearchFlt = f.single_search_filter === true ? true : false;
- //calls function after row is validated
- this.onRowValidated = _types.Types.isFn(f.on_row_validated) ? f.on_row_validated : null;
- //array defining columns for customCellData event
- this.customCellDataCols = f.custom_cell_data_cols ? f.custom_cell_data_cols : [];
- //calls custom function for retrieving cell data
- this.customCellData = _types.Types.isFn(f.custom_cell_data) ? f.custom_cell_data : null;
- //input watermark text array
- this.watermark = f.watermark || '';
- this.isWatermarkArray = _types.Types.isArray(this.watermark);
- //id of toolbar container element
- this.toolBarTgtId = f.toolbar_target_id || null;
- //enables/disables help div
- this.helpInstructions = f.help_instructions || false;
- //popup filters
- this.popUpFilters = f.popup_filters === true ? true : false;
- //active columns color
- this.markActiveColumns = f.mark_active_columns === true ? true : false;
- //defines css class for active column header
- this.activeColumnsCssClass = f.active_columns_css_class || 'activeHeader';
- //calls function before active column header is marked
- this.onBeforeActiveColumn = _types.Types.isFn(f.on_before_active_column) ? f.on_before_active_column : null;
- //calls function after active column header is marked
- this.onAfterActiveColumn = _types.Types.isFn(f.on_after_active_column) ? f.on_after_active_column : null;
-
- /*** select filter's customisation and behaviours ***/
- //defines 1st option text
- this.displayAllText = f.display_all_text || '';
- //enables/disables empty option in combo-box filters
- this.enableEmptyOption = f.enable_empty_option === true ? true : false;
- //defines empty option text
- this.emptyText = f.empty_text || '(Empty)';
- //enables/disables non empty option in combo-box filters
- this.enableNonEmptyOption = f.enable_non_empty_option === true ? true : false;
- //defines empty option text
- this.nonEmptyText = f.non_empty_text || '(Non empty)';
- //enables/disables onChange event on combo-box
- this.onSlcChange = f.on_change === false ? false : true;
- //enables/disables select options sorting
- this.sortSlc = f.sort_select === false ? false : true;
- //enables/disables ascending numeric options sorting
- this.isSortNumAsc = f.sort_num_asc === true ? true : false;
- this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null;
- //enables/disables descending numeric options sorting
- this.isSortNumDesc = f.sort_num_desc === true ? true : false;
- this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null;
- //enabled selects are populated on demand
- this.fillSlcOnDemand = f.fill_slc_on_demand === true ? true : false;
- this.hasCustomSlcOptions = _types.Types.isObj(f.custom_slc_options) ? true : false;
- this.customSlcOptions = _types.Types.isArray(f.custom_slc_options) ? f.custom_slc_options : null;
-
- /*** Filter operators ***/
- this.rgxOperator = f.regexp_operator || 'rgx:';
- this.emOperator = f.empty_operator || '[empty]';
- this.nmOperator = f.nonempty_operator || '[nonempty]';
- this.orOperator = f.or_operator || '||';
- this.anOperator = f.and_operator || '&&';
- this.grOperator = f.greater_operator || '>';
- this.lwOperator = f.lower_operator || '<';
- this.leOperator = f.lower_equal_operator || '<=';
- this.geOperator = f.greater_equal_operator || '>=';
- this.dfOperator = f.different_operator || '!';
- this.lkOperator = f.like_operator || '*';
- this.eqOperator = f.equal_operator || '=';
- this.stOperator = f.start_with_operator || '{';
- this.enOperator = f.end_with_operator || '}';
- this.curExp = f.cur_exp || '^[¥£€$]';
- this.separator = f.separator || ',';
-
- /*** rows counter ***/
- //show/hides rows counter
- this.rowsCounter = f.rows_counter === true ? true : false;
-
- /*** status bar ***/
- //show/hides status bar
- this.statusBar = f.status_bar === true ? true : false;
-
- /*** loader ***/
- //enables/disables loader/spinner indicator
- this.loader = f.loader === true ? true : false;
-
- /*** validation - reset buttons/links ***/
- //show/hides filter's validation button
- this.displayBtn = f.btn === true ? true : false;
- //defines validation button text
- this.btnText = f.btn_text || (!this.enableIcons ? 'Go' : '');
- //defines css class for validation button
- this.btnCssClass = f.btn_css_class || (!this.enableIcons ? 'btnflt' : 'btnflt_icon');
- //show/hides reset link
- this.btnReset = f.btn_reset === true ? true : false;
- //defines css class for reset button
- this.btnResetCssClass = f.btn_reset_css_class || 'reset';
- //callback function before filters are cleared
- this.onBeforeReset = _types.Types.isFn(f.on_before_reset) ? f.on_before_reset : null;
- //callback function after filters are cleared
- this.onAfterReset = _types.Types.isFn(f.on_after_reset) ? f.on_after_reset : null;
-
- /*** paging ***/
- //enables/disables table paging
- this.paging = f.paging === true ? true : false;
- this.nbVisibleRows = 0; //nb visible rows
- this.nbHiddenRows = 0; //nb hidden rows
-
- /*** webfx sort adapter ***/
- //enables/disables default table sorting
- this.sort = f.sort === true ? true : false;
- //indicates if sort is set (used in tfAdapter.sortabletable.js)
- this.isSortEnabled = false;
- this.sortConfig = f.sort_config || {};
- this.sortConfig.name = this.sortConfig.name !== undefined ? f.sort_config.name : 'sortabletable';
- this.sortConfig.src = this.sortConfig.src !== undefined ? f.sort_config.src : this.extensionsPath + 'sortabletable/' + 'sortabletable.js';
- this.sortConfig.adapterSrc = this.sortConfig.adapter_src !== undefined ? f.sort_config.adapter_src : this.extensionsPath + 'sortabletable/adapterSortabletable.js';
- this.sortConfig.initialize = this.sortConfig.initialize !== undefined ? f.sort_config.initialize : function (o) {};
- this.sortConfig.sortTypes = _types.Types.isArray(this.sortConfig.sort_types) ? f.sort_config.sort_types : [];
- this.sortConfig.sortCol = this.sortConfig.sort_col !== undefined ? f.sort_config.sort_col : null;
- this.sortConfig.asyncSort = this.sortConfig.async_sort === true ? true : false;
- this.sortConfig.triggerIds = _types.Types.isArray(this.sortConfig.sort_trigger_ids) ? f.sort_config.sort_trigger_ids : [];
-
- /*** ezEditTable extension ***/
- //enables/disables table selection feature
- this.selectable = f.selectable === true ? true : false;
- //enables/disables editable table feature
- this.editable = f.editable === true ? true : false;
- this.ezEditTableConfig = f.ezEditTable_config || {};
- this.ezEditTableConfig.name = this.ezEditTableConfig.name !== undefined ? f.ezEditTable_config.name : 'ezedittable';
- this.ezEditTableConfig.src = this.ezEditTableConfig.src !== undefined ? f.ezEditTable_config.src : this.extensionsPath + 'ezEditTable/ezEditTable.js';
- //ezEditTable stylesheet not imported by default as filtergrid.css
- //applies
- this.ezEditTableConfig.loadStylesheet = this.ezEditTableConfig.loadStylesheet === true ? true : false;
- this.ezEditTableConfig.stylesheet = this.ezEditTableConfig.stylesheet || this.extensionsPath + 'ezEditTable/ezEditTable.css';
- this.ezEditTableConfig.stylesheetName = this.ezEditTableConfig.stylesheetName !== undefined ? f.ezEditTable_config.stylesheetName : 'ezEditTableCss';
- this.ezEditTableConfig.err = 'Failed to instantiate EditTable ' + 'object.\n"ezEditTable" module may not be available.';
-
- /*** onkeyup event ***/
- //enables/disables onkeyup event, table is filtered when user stops
- //typing
- this.onKeyUp = f.on_keyup === true ? true : false;
- //onkeyup delay timer (msecs)
- this.onKeyUpDelay = !isNaN(f.on_keyup_delay) ? f.on_keyup_delay : 900;
- this.isUserTyping = null; //typing indicator
- this.onKeyUpTimer = undefined;
-
- /*** keyword highlighting ***/
- //enables/disables keyword highlighting
- this.highlightKeywords = f.highlight_keywords === true ? true : false;
-
- /*** data types ***/
- //defines default date type (european DMY)
- this.defaultDateType = f.default_date_type || 'DMY';
- //defines default thousands separator
- //US = ',' EU = '.'
- this.thousandsSeparator = f.thousands_separator || ',';
- //defines default decimal separator
- //US & javascript = '.' EU = ','
- this.decimalSeparator = f.decimal_separator || '.';
- //enables number format per column
- this.hasColNbFormat = f.col_number_format === true ? true : false;
- //array containing columns nb formats
- this.colNbFormat = _types.Types.isArray(this.hasColNbFormat) ? f.col_number_format : null;
- //enables date type per column
- this.hasColDateType = f.col_date_type === true ? true : false;
- //array containing columns date type
- this.colDateType = _types.Types.isArray(this.hasColDateType) ? f.col_date_type : null;
-
- /*** status messages ***/
- //filtering
- this.msgFilter = f.msg_filter || 'Filtering data...';
- //populating drop-downs
- this.msgPopulate = f.msg_populate || 'Populating filter...';
- //populating drop-downs
- this.msgPopulateCheckList = f.msg_populate_checklist || 'Populating list...';
- //changing paging page
- this.msgChangePage = f.msg_change_page || 'Collecting paging data...';
- //clearing filters
- this.msgClear = f.msg_clear || 'Clearing filters...';
- //changing nb results/page
- this.msgChangeResults = f.msg_change_results || 'Changing results per page...';
- //re-setting grid values
- this.msgResetValues = f.msg_reset_grid_values || 'Re-setting filters values...';
- //re-setting page
- this.msgResetPage = f.msg_reset_page || 'Re-setting page...';
- //re-setting page length
- this.msgResetPageLength = f.msg_reset_page_length || 'Re-setting page length...';
- //table sorting
- this.msgSort = f.msg_sort || 'Sorting data...';
- //extensions loading
- this.msgLoadExtensions = f.msg_load_extensions || 'Loading extensions...';
- //themes loading
- this.msgLoadThemes = f.msg_load_themes || 'Loading theme(s)...';
-
- /*** ids prefixes ***/
- //css class name added to table
- this.prfxTf = 'TF';
- //filters (inputs - selects)
- this.prfxFlt = 'flt';
- //validation button
- this.prfxValButton = 'btn';
- //container div for paging elements, rows counter etc.
- this.prfxInfDiv = 'inf_';
- //left div
- this.prfxLDiv = 'ldiv_';
- //right div
- this.prfxRDiv = 'rdiv_';
- //middle div
- this.prfxMDiv = 'mdiv_';
- //filter values cookie
- this.prfxCookieFltsValues = 'tf_flts_';
- //page nb cookie
- this.prfxCookiePageNb = 'tf_pgnb_';
- //page length cookie
- this.prfxCookiePageLen = 'tf_pglen_';
-
- /*** cookies ***/
- this.hasStoredValues = false;
- //remembers filters values on page load
- this.rememberGridValues = f.remember_grid_values === true ? true : false;
- //cookie storing filter values
- this.fltsValuesCookie = this.prfxCookieFltsValues + this.id;
- //remembers page nb on page load
- this.rememberPageNb = this.paging && f.remember_page_number ? true : false;
- //cookie storing page nb
- this.pgNbCookie = this.prfxCookiePageNb + this.id;
- //remembers page length on page load
- this.rememberPageLen = this.paging && f.remember_page_length ? true : false;
- //cookie storing page length
- this.pgLenCookie = this.prfxCookiePageLen + this.id;
-
- /*** extensions ***/
- //imports external script
- // this.hasExtensions = f.extensions===true ? true : false;
- // this.extensions = this.hasExtensions ? f.extensions : null;
- this.extensions = f.extensions;
- this.hasExtensions = _types.Types.isArray(this.extensions);
-
- /*** themes ***/
- this.enableDefaultTheme = f.enable_default_theme === true ? true : false;
- //imports themes
- this.hasThemes = f.enable_default_theme || f.themes && _types.Types.isObj(f.themes) ? true : false;
- this.themes = this.hasThemes ? f.themes : null;
- //themes path
- this.themesPath = f.themes_path || this.basePath + 'TF_Themes/';
-
- // Features registry
- this.Cpt = {
- loader: null,
- alternateRows: null,
- colOps: null,
- rowsCounter: null,
- gridLayout: null,
- store: null,
- highlightKeywords: null,
- paging: null,
- checkList: null,
- dropdown: null,
- popupFilter: null,
- clearButton: null,
- help: null,
- statusBar: null
- };
-
- // Extensions registry
- this.ExtRegistry = {
- sort: null,
- ezEditTable: null
- };
-
- /*** TF events ***/
- var o = this;
- this.Evt = {
- name: {
- filter: 'Filter',
- dropdown: 'dropdown',
- checklist: 'checkList',
- changepage: 'changePage',
- clear: 'Clear',
- changeresultsperpage: 'changeResults',
- resetvalues: 'ResetValues',
- resetpage: 'resetPage',
- resetpagelength: 'resetPageLength',
- sort: 'Sort',
- loadextensions: 'LoadExtensions',
- loadthemes: 'loadThemes'
- },
-
- /*====================================================
- - Detects key for a given element
- =====================================================*/
- detectKey: function detectKey(e) {
- if (!o.enterKey) {
- return;
- }
- var _evt = e || global.event;
- if (_evt) {
- var key = _evt.Event.keyCode(_evt);
- if (key === 13) {
- o._filter();
- _evt.Event.cancel(_evt);
- _evt.Event.stop(_evt);
- } else {
- o.isUserTyping = true;
- global.clearInterval(o.onKeyUpTimer);
- o.onKeyUpTimer = undefined;
- }
- } //if evt
- },
- /*====================================================
- - onkeyup event for text filters
- =====================================================*/
- onKeyUp: function onKeyUp(e) {
- if (!o.onKeyUp) {
- return;
- }
- var _evt = e || global.event;
- var key = _evt.Event.keyCode(_evt);
- o.isUserTyping = false;
-
- function filter() {
- global.clearInterval(o.onKeyUpTimer);
- o.onKeyUpTimer = undefined;
- if (!o.isUserTyping) {
- o.filter();
- o.isUserTyping = null;
- }
- }
-
- if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) {
- if (o.onKeyUpTimer === undefined) {
- o.onKeyUpTimer = global.setInterval(filter, o.onKeyUpDelay);
- }
- } else {
- global.clearInterval(o.onKeyUpTimer);
- o.onKeyUpTimer = undefined;
- }
- },
- /*====================================================
- - onkeydown event for input filters
- =====================================================*/
- onKeyDown: function onKeyDown(e) {
- if (!o.onKeyUp) {
- return;
- }
- o.isUserTyping = true;
- },
- /*====================================================
- - onblur event for input filters
- =====================================================*/
- onInpBlur: function onInpBlur(e) {
- if (o.onKeyUp) {
- o.isUserTyping = false;
- global.clearInterval(o.onKeyUpTimer);
- }
- if (o.ezEditTable) {
- if (o.editable) {
- o.ezEditTable.Editable.Set();
- }
- if (o.selectable) {
- o.ezEditTable.Selection.Set();
- }
- }
- },
- /*====================================================
- - onfocus event for input filters
- =====================================================*/
- onInpFocus: function onInpFocus(e) {
- var _evt = e || global.event;
- o.activeFilterId = this.getAttribute('id');
- o.activeFlt = _dom.Dom.id(o.activeFilterId);
- if (o.popUpFilters) {
- _evt.Event.cancel(_evt);
- _evt.Event.stop(_evt);
- }
- if (o.ezEditTable) {
- if (o.editable) {
- o.ezEditTable.Editable.Remove();
- }
- if (o.selectable) {
- o.ezEditTable.Selection.Remove();
- }
- }
- },
- /*====================================================
- - onfocus event for select filters
- =====================================================*/
- onSlcFocus: function onSlcFocus(e) {
- var _evt = e || global.event;
- o.activeFilterId = this.getAttribute('id');
- o.activeFlt = _dom.Dom.id(o.activeFilterId);
- // select is populated when element has focus
- if (o.fillSlcOnDemand && this.getAttribute('filled') === '0') {
- var ct = this.getAttribute('ct');
- o.Cpt.dropdown._build(ct);
- }
- if (o.popUpFilters) {
- _evt.Event.cancel(_evt);
- _evt.Event.stop(_evt);
- }
- },
- /*====================================================
- - onchange event for select filters
- =====================================================*/
- onSlcChange: function onSlcChange(e) {
- if (!o.activeFlt) {
- return;
- }
- var colIndex = o.activeFlt.getAttribute('colIndex');
- //Checks filter is a checklist and caller is not null
- // if(o.activeFlt && colIndex &&
- // o['col'+colIndex]===o.fltTypeCheckList &&
- // !o.Evt.onSlcChange.caller){ return; }
- var _evt = e || global.event;
- if (o.popUpFilters) {
- _evt.Event.stop(_evt);
- }
- if (o.onSlcChange) {
- o.filter();
- }
- },
- /*====================================================
- - onblur event for select filters
- =====================================================*/
- // _OnSlcBlur: function(e) {},
- /*====================================================
- - onclick event for checklist filters
- =====================================================*/
- onCheckListClick: function onCheckListClick() {
- if (o.fillSlcOnDemand && this.getAttribute('filled') === '0') {
- var ct = this.getAttribute('ct');
- o.Cpt.checkList._build(ct);
- o.Cpt.checkList.checkListDiv[ct].onclick = null;
- o.Cpt.checkList.checkListDiv[ct].title = '';
- }
- },
- /*====================================================
- - onclick event for checklist filter container
- =====================================================*/
- onCheckListFocus: function onCheckListFocus(e) {
- o.activeFilterId = this.firstChild.getAttribute('id');
- o.activeFlt = _dom.Dom.id(o.activeFilterId);
- },
- /*====================================================
- - onclick event for validation button
- (btn property)
- =====================================================*/
- onBtnClick: function onBtnClick() {
- o.filter();
- }
- // ,
- // _OnSlcPagesChangeEvt: null, //used by sort adapter
- /*====================================================
- - onclick event slc parent node (enables filters)
- IE only
- =====================================================*/
- // _EnableSlc: function() {
- // this.firstChild.disabled = false;
- // this.firstChild.focus();
- // this.onclick = null;
- // },
-
- // _Paging: { //used by sort adapter
- // nextEvt: null,
- // prevEvt: null,
- // lastEvt: null,
- // firstEvt: null
- // }
- };
- }
-
- _createClass(TableFilter, [{
- key: 'init',
-
- /*====================================================
- - initialises filtering grid bar behaviours and
- layout
- =====================================================*/
- value: function init() {
- if (this._hasGrid) {
- return;
- }
- if (!this.tbl) {
- this.tbl = _dom.Dom.id(this.id);
- }
- if (this.gridLayout) {
- this.refRow = this.startRow === null ? 0 : this.startRow;
- }
- if (this.popUpFilters && (this.filtersRowIndex === 0 && this.headersRow === 1 || this.gridLayout)) {
- this.headersRow = 0;
- }
- var f = this.cfg,
- n = this.singleSearchFlt ? 1 : this.nbCells,
- inpclass;
-
- if (window['tf_' + this.id] === undefined) {
- window['tf_' + this.id] = this;
- }
-
- //loads stylesheet if not imported
- //Issues with browsers != IE, IE rules in this case
- this.includeFile(this.stylesheetId, this.stylesheet, null, 'link');
-
- //loads theme
- if (this.hasThemes) {
- this._loadThemes();
- }
-
- if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) {
- //var Store = require('modules/store').Store;
- // import {Store} from 'modules/store';
- this.Cpt.store = new _Store.Store(this);
- }
-
- if (this.gridLayout) {
- // var GridLayout = require('modules/gridLayout').GridLayout;
- // import {GridLayout} from 'modules/gridLayout';
- this.Cpt.gridLayout = new _GridLayout.GridLayout(this);
- this.Cpt.gridLayout.init();
- }
-
- if (this.loader) {
- if (!this.Cpt.loader) {
- // var Loader = require('modules/loader').Loader;
- // import {Loader} from 'modules/loader';
- this.Cpt.loader = new _Loader.Loader(this);
- }
- }
-
- if (this.highlightKeywords) {
- // var Highlight =
- // require('modules/highlightKeywords').HighlightKeyword;
- // import {HighlightKeyword} from 'modules/highlightKeywords';
- this.Cpt.highlightKeyword = new _HighlightKeyword.HighlightKeyword(this);
- }
-
- if (this.popUpFilters) {
- if (!this.Cpt.popupFilter) {
- // var PopupFilter = require('modules/popupFilter').PopupFilter;
- // import {PopupFilter} from 'modules/popupFilter';
- this.Cpt.popupFilter = new _PopupFilter.PopupFilter(this);
- }
- this.Cpt.popupFilter.init();
- }
-
- //filters grid is not generated
- if (!this.fltGrid) {
- this.refRow = this.refRow - 1;
- if (this.gridLayout) {
- this.refRow = 0;
- }
- this.nbFilterableRows = this.getRowsNb();
- this.nbVisibleRows = this.nbFilterableRows;
- this.nbRows = this.nbFilterableRows + this.refRow;
- } else {
- if (this.isFirstLoad) {
- var fltrow;
- if (!this.gridLayout) {
- var thead = _dom.Dom.tag(this.tbl, 'thead');
- if (thead.length > 0) {
- fltrow = thead[0].insertRow(this.filtersRowIndex);
- } else {
- fltrow = this.tbl.insertRow(this.filtersRowIndex);
- }
-
- if (this.headersRow > 1 && this.filtersRowIndex <= this.headersRow && !this.popUpFilters) {
- this.headersRow++;
- }
- if (this.popUpFilters) {
- this.headersRow++;
- }
-
- fltrow.className = this.fltsRowCssClass;
- //Disable for grid_layout
- if (this.isExternalFlt && (!this.gridLayout || this.popUpFilters)) {
- fltrow.style.display = 'none';
- }
- }
-
- this.nbFilterableRows = this.getRowsNb();
- this.nbVisibleRows = this.nbFilterableRows;
- this.nbRows = this.tbl.rows.length;
-
- for (var i = 0; i < n; i++) {
- // this loop adds filters
-
- if (this.popUpFilters) {
- this.Cpt.popupFilter.build(i);
- }
-
- var fltcell = _dom.Dom.create(this.fltCellTag),
- col = this['col' + i],
- externalFltTgtId = this.isExternalFlt && this.externalFltTgtIds ? this.externalFltTgtIds[i] : null;
-
- if (this.singleSearchFlt) {
- fltcell.colSpan = this.nbCells;
- }
- if (!this.gridLayout) {
- fltrow.appendChild(fltcell);
- }
- inpclass = i == n - 1 && this.displayBtn ? this.fltSmallCssClass : this.fltCssClass;
-
- if (col === undefined) {
- col = f['col_' + i] === undefined ? this.fltTypeInp : _str.Str.lower(f['col_' + i]);
- }
-
- //only 1 input for single search
- if (this.singleSearchFlt) {
- col = this.fltTypeInp;
- inpclass = this.singleFltCssClass;
- }
-
- //drop-down filters
- if (col === this.fltTypeSlc || col === this.fltTypeMulti) {
- if (!this.Cpt.dropdown) {
- // var Dropdown = require('modules/dropdown').Dropdown;
- // import {Dropdown} from 'modules/dropdown';
- this.Cpt.dropdown = new _Dropdown.Dropdown(this);
- }
- var dropdown = this.Cpt.dropdown;
-
- var slc = _dom.Dom.create(this.fltTypeSlc, ['id', this.prfxFlt + i + '_' + this.id], ['ct', i], ['filled', '0']);
-
- if (col === this.fltTypeMulti) {
- slc.multiple = this.fltTypeMulti;
- slc.title = dropdown.multipleSlcTooltip;
- }
- slc.className = _str.Str.lower(col) === this.fltTypeSlc ? inpclass : this.fltMultiCssClass; // for ie<=6
-
- //filter is appended in desired external element
- if (externalFltTgtId) {
- _dom.Dom.id(externalFltTgtId).appendChild(slc);
- this.externalFltEls.push(slc);
- } else {
- fltcell.appendChild(slc);
- }
-
- this.fltIds.push(this.prfxFlt + i + '_' + this.id);
-
- if (!this.fillSlcOnDemand) {
- dropdown._build(i);
- }
-
- _evt.Event.add(slc, 'keypress', this.Evt.detectKey);
- _evt.Event.add(slc, 'change', this.Evt.onSlcChange);
- _evt.Event.add(slc, 'focus', this.Evt.onSlcFocus);
- // evt.add(slc, 'blur', this.Evt._OnSlcBlur);
-
- //1st option is created here since dropdown.build isn't
- //invoked
- if (this.fillSlcOnDemand) {
- var opt0 = _dom.Dom.createOpt(this.displayAllText, '');
- slc.appendChild(opt0);
- }
- }
- // checklist
- else if (col === this.fltTypeCheckList) {
- var checkList;
- if (!this.Cpt.checkList) {
- // var CheckList =
- // require('modules/checkList').CheckList;
- // import {CheckList} from 'modules/checkList';
- this.Cpt.checkList = new _CheckList.CheckList(this);
- checkList = this.Cpt.checkList;
- }
-
- var divCont = _dom.Dom.create('div', ['id', checkList.prfxCheckListDiv + i + '_' + this.id], ['ct', i], ['filled', '0']);
- divCont.className = checkList.checkListDivCssClass;
-
- //filter is appended in desired element
- if (externalFltTgtId) {
- _dom.Dom.id(externalFltTgtId).appendChild(divCont);
- this.externalFltEls.push(divCont);
- } else {
- fltcell.appendChild(divCont);
- }
-
- checkList.checkListDiv[i] = divCont;
- this.fltIds.push(this.prfxFlt + i + '_' + this.id);
- if (!this.fillSlcOnDemand) {
- checkList._build(i);
- }
-
- if (this.fillSlcOnDemand) {
- _evt.Event.add(divCont, 'click', this.Evt.onCheckListClick);
- divCont.appendChild(_dom.Dom.text(checkList.activateCheckListTxt));
- }
-
- _evt.Event.add(divCont, 'click', this.Evt.onCheckListFocus);
- } else {
- //show/hide input
- var inptype = col === this.fltTypeInp ? 'text' : 'hidden';
- var inp = _dom.Dom.create(this.fltTypeInp, ['id', this.prfxFlt + i + '_' + this.id], ['type', inptype], ['ct', i]);
- if (inptype !== 'hidden' && this.watermark) {
- inp.setAttribute('placeholder', this.isWatermarkArray ? this.watermark[i] || '' : this.watermark);
- }
- inp.className = inpclass;
- inp.onfocus = this.Evt.onInpFocus;
-
- //filter is appended in desired element
- if (externalFltTgtId) {
- _dom.Dom.id(externalFltTgtId).appendChild(inp);
- this.externalFltEls.push(inp);
- } else {
- fltcell.appendChild(inp);
- }
-
- this.fltIds.push(this.prfxFlt + i + '_' + this.id);
-
- inp.onkeypress = this.Evt.detectKey;
- inp.onkeydown = this.Evt.onKeyDown;
- inp.onkeyup = this.Evt.onKeyUp;
- inp.onblur = this.Evt.onInpBlur;
-
- if (this.rememberGridValues) {
- var flts_values = this.Cpt.store.getFilterValues(this.fltsValuesCookie);
- if (flts_values[i] != ' ') {
- this.setFilterValue(i, flts_values[i], false);
- }
- }
- }
- // this adds submit button
- if (i == n - 1 && this.displayBtn) {
- var btn = _dom.Dom.create(this.fltTypeInp, ['id', this.prfxValButton + i + '_' + this.id], ['type', 'button'], ['value', this.btnText]);
- btn.className = this.btnCssClass;
-
- //filter is appended in desired element
- if (externalFltTgtId) {
- _dom.Dom.id(externalFltTgtId).appendChild(btn);
- } else {
- fltcell.appendChild(btn);
- }
-
- btn.onclick = this.Evt.onBtnClick;
- } //if
- } // for i
- } else {
- this._resetGrid();
- } //if isFirstLoad
- } //if this.fltGrid
-
- /* Filter behaviours */
- if (this.rowsCounter) {
- // var RowsCounter = require('modules/rowsCounter').RowsCounter;
- // import {RowsCounter} from 'modules/rowsCounter';
- this.Cpt.rowsCounter = new _RowsCounter.RowsCounter(this);
- this.Cpt.rowsCounter.init();
- }
- if (this.statusBar) {
- // var StatusBar = require('modules/statusBar').StatusBar;
- // import {StatusBar} from 'modules/statusBar';
- this.Cpt.statusBar = new _StatusBar.StatusBar(this);
- this.Cpt.statusBar.init();
- }
- if (this.paging || this.Cpt.paging && this.Cpt.paging.isPagingRemoved) {
- // var Paging = require('modules/paging').Paging;
- // import {Paging} from 'modules/paging';
- // if(!this.Cpt.paging){
- this.Cpt.paging = new _Paging.Paging(this);
- // }
- this.Cpt.paging.init();
- }
- if (this.btnReset) {
- // var ClearButton = require('modules/clearButton').ClearButton;
- // import {ClearButton} from 'modules/clearButton';
- this.Cpt.clearButton = new _ClearButton.ClearButton(this);
- this.Cpt.clearButton.init();
- }
- if (this.helpInstructions) {
- // var Help = require('modules/help').Help;
- // import {Help} from 'modules/help';
- this.Cpt.help = new _Help.Help(this);
- this.Cpt.help.init();
- }
- if (this.hasColWidth && !this.gridLayout) {
- this.setColWidths();
- }
- if (this.alternateBgs) {
- //1st time only if no paging and rememberGridValues
- // var AlternateRows = require('modules/alternateRows').AlternateRows;
- // import {AlternateRows} from 'modules/alternateRows';
- this.Cpt.alternateRows = new _AlternateRows.AlternateRows(this);
- this.Cpt.alternateRows.init();
- }
- if (this.hasColOperation) {
- // var ColOps = require('modules/colOps').ColOps;
- // import {ColOps} from 'modules/colOps';
- this.Cpt.colOps = new _ColOps.ColOps(this);
- this.Cpt.colOps.calc();
- }
- if (this.sort /*|| this.gridLayout*/) {
- this.setSort();
- }
- if (this.selectable || this.editable) {
- this.setEditable();
- }
-
- this.isFirstLoad = false;
- this._hasGrid = true;
-
- if (this.rememberGridValues || this.rememberPageLen || this.rememberPageNb) {
- this.resetValues();
- }
-
- //TF css class is added to table
- if (!this.gridLayout) {
- _dom.Dom.addClass(this.tbl, this.prfxTf);
- }
-
- if (this.loader) {
- this.Cpt.loader.show('none');
- }
-
- /* Loads extensions */
- if (this.hasExtensions) {
- // this.loadExtensions();
- // this.registerExtensions();
- this.initExtensions();
- }
-
- if (this.onFiltersLoaded) {
- this.onFiltersLoaded.call(null, this);
- }
- }
- }, {
- key: 'EvtManager',
-
- /*====================================================
- - TF events manager
- - Params:
- - event name (string)
- - config object (optional literal object)
- =====================================================*/
- value: function EvtManager(evt, s) {
- var o = this;
- var slcIndex = s && s.slcIndex !== undefined ? s.slcIndex : null;
- var slcExternal = s && s.slcExternal !== undefined ? s.slcExternal : false;
- var slcId = s && s.slcId !== undefined ? s.slcId : null;
- var pgIndex = s && s.pgIndex !== undefined ? s.pgIndex : null;
-
- function efx() {
- if (!evt) {
- return;
- }
- switch (evt) {
- case o.Evt.name.filter:
- if (o.isModFilterFn) {
- o.modFilterFn.call(null, o);
- } else {
- o._filter();
- }
- break;
- case o.Evt.name.dropdown:
- if (o.linkedFilters) {
- o.Cpt.dropdown._build(slcIndex, true);
- } else {
- o.Cpt.dropdown._build(slcIndex, false, slcExternal, slcId);
- }
- break;
- case o.Evt.name.checklist:
- o.Cpt.checkList._build(slcIndex, slcExternal, slcId);
- break;
- case o.Evt.name.changepage:
- o.Cpt.paging._changePage(pgIndex);
- break;
- case o.Evt.name.clear:
- o._clearFilters();
- o._filter();
- break;
- case o.Evt.name.changeresultsperpage:
- o.Cpt.paging._changeResultsPerPage();
- break;
- case o.Evt.name.resetvalues:
- o._resetValues();
- o._filter();
- break;
- case o.Evt.name.resetpage:
- o.Cpt.paging._resetPage(o.pgNbCookie);
- break;
- case o.Evt.name.resetpagelength:
- o.Cpt.paging._resetPageLength(o.pgLenCookie);
- break;
- case o.Evt.name.sort:
- void 0;
- break;
- case o.Evt.name.loadextensions:
- o._loadExtensions();
- break;
- case o.Evt.name.loadthemes:
- o._loadThemes();
- break;
- default:
- //to be used by extensions events when needed
- o['_' + evt].call(null, o, s);
- break;
- }
- if (o.statusBar) {
- o.Cpt.statusBar.message('');
- }
- if (o.loader) {
- o.Cpt.loader.show('none');
- }
- }
-
- if (this.loader || this.statusBar) {
- try {
- this.Cpt.loader.show('');
- this.Cpt.statusBar.message(this['msg' + evt]);
- } catch (e) {}
- global.setTimeout(efx, this.execDelay);
- } else {
- efx();
- }
- }
- }, {
- key: 'initExtensions',
- value: function initExtensions() {
- var exts = this.extensions;
-
- for (var i = 0; i < exts.length; i++) {
- var ext = exts[i];
- if (_types.Types.isUndef(this.ExtRegistry[ext.name])) {
- this.loadExtension(ext);
- }
- }
- }
- }, {
- key: 'loadExtension',
- value: function loadExtension(ext) {
- var _this = this;
-
- if (!ext || !ext.name) {
- return;
- }
-
- var name = ext.name;
- var path = ext.path;
- var modulePath;
-
- if (name && path) {
- modulePath = ext.path + '/' + name;
- } else {
- name = name.replace('.js', '');
- modulePath = './extensions/{}/{}'.replace(/{}/g, name);
- }
-
- __webpack_require__.e/* require */(1, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(1)(modulePath)]; (function (mod) {
- var inst = new mod(_this, ext);
- inst.init();
- _this.ExtRegistry[name] = inst;
- }.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});
- }
- }, {
- key: 'loadThemes',
- value: function loadThemes() {
- this.EvtManager(this.Evt.name.loadthemes);
- }
- }, {
- key: '_loadThemes',
-
- /*====================================================
- - loads TF themes
- =====================================================*/
- value: function _loadThemes() {
- if (!this.hasThemes) {
- return;
- }
- if (!this.Thm) {
- /*** TF themes ***/
- var o = this;
- this.Thm = {
- list: {},
- add: function add(thmName, thmDesc, thmPath, thmCallBack) {
- var file = thmPath.split('/')[thmPath.split('/').length - 1],
- re = new RegExp(file),
- path = thmPath.replace(re, '');
- o.Thm.list[thmName] = {
- name: thmName,
- description: thmDesc,
- file: file,
- path: path,
- callback: thmCallBack
- };
- }
- };
- }
-
- //Default theme config
- if (this.enableDefaultTheme) {
- this.themes = {
- name: ['DefaultTheme'],
- src: [this.themesPath + 'Default/TF_Default.css'],
- description: ['Default Theme']
- };
- this.Thm.add('DefaultTheme', this.themesPath + 'Default/TF_Default.css', 'Default Theme');
- }
- if (_types.Types.isArray(this.themes.name) && _types.Types.isArray(this.themes.src)) {
- var thm = this.themes;
- for (var i = 0; i < thm.name.length; i++) {
- var thmPath = thm.src[i],
- thmName = thm.name[i],
- thmInit = thm.initialize && thm.initialize[i] ? thm.initialize[i] : null,
- thmDesc = thm.description && thm.description[i] ? thm.description[i] : null;
-
- //Registers theme
- this.Thm.add(thmName, thmDesc, thmPath, thmInit);
-
- if (!this.isImported(thmPath, 'link')) {
- this.includeFile(thmName, thmPath, null, 'link');
- }
- if (_types.Types.isFn(thmInit)) {
- thmInit.call(null, this);
- }
- }
- }
-
- //Some elements need to be overriden for theme
- //Reset button
- this.btnResetText = null;
- this.btnResetHtml = ' ';
-
- //Paging buttons
- this.btnPrevPageHtml = ' ';
- this.btnNextPageHtml = ' ';
- this.btnFirstPageHtml = ' ';
- this.btnLastPageHtml = ' ';
-
- //Loader
- this.loader = true;
- this.loaderHtml = '
';
- this.loaderText = null;
- }
- }, {
- key: 'remove',
-
- /*====================================================
- - removes a filter grid
- =====================================================*/
- value: function remove() {
- if (this.fltGrid && this._hasGrid) {
- var rows = this.tbl.rows;
- if (this.paging) {
- this.Cpt.paging.destroy();
- }
- if (this.statusBar) {
- this.Cpt.statusBar.destroy();
- }
- if (this.rowsCounter) {
- this.Cpt.rowsCounter.destroy();
- }
- if (this.btnReset) {
- this.Cpt.clearButton.destroy();
- }
- if (this.helpInstructions) {
- this.Cpt.help.destroy();
- }
- if (this.isExternalFlt && !this.popUpFilters) {
- this.removeExternalFlts();
- }
- if (this.infDiv) {
- this.removeToolbar();
- }
- if (this.highlightKeywords) {
- this.Cpt.highlightKeyword.unhighlightAll();
- }
- if (this.sort) {
- // this.RemoveSort();
- this.ExtRegistry.sort.destroy();
- }
- if (this.loader) {
- this.Cpt.loader.remove();
- }
- if (this.popUpFilters) {
- this.Cpt.popupFilter.destroy();
- }
- if (this.markActiveColumns) {
- this.clearActiveColumns();
- }
- if (this.editable || this.selectable) {
- this.removeEditable();
- }
- //this loop shows all rows and removes validRow attribute
- for (var j = this.refRow; j < this.nbRows; j++) {
- rows[j].style.display = '';
- try {
- if (rows[j].hasAttribute('validRow')) {
- rows[j].removeAttribute('validRow');
- }
- } catch (e) {
- //ie<=6 doesn't support hasAttribute method
- var row = rows[j];
- var attribs = row.attributes;
- for (var x = 0; x < attribs.length; x++) {
- if (_str.Str.lower(attribs.nodeName) === 'validrow') {
- row.removeAttribute('validRow');
- }
- }
- }
-
- //removes alternating colors
- if (this.alternateBgs) {
- this.Cpt.alternateRows.removeRowBg(j);
- }
- } //for j
-
- if (this.fltGrid && !this.gridLayout) {
- this.fltGridEl = rows[this.filtersRowIndex];
- this.tbl.deleteRow(this.filtersRowIndex);
- }
- if (this.gridLayout) {
- this.Cpt.gridLayout.destroy();
- }
- _dom.Dom.removeClass(this.tbl, this.prfxTf);
- this.activeFlt = null;
- this.isStartBgAlternate = true;
- this._hasGrid = false;
- this.tbl = null;
- } //if this.fltGrid
- }
- }, {
- key: 'setToolbar',
-
- /*====================================================
- - Generates div above table where paging,
- reset button, rows counter label etc. are placed
- =====================================================*/
- value: function setToolbar() {
- if (this.infDiv !== null) {
- return;
- }
-
- /*** container div ***/
- var infdiv = _dom.Dom.create('div', ['id', this.prfxInfDiv + this.id]);
- infdiv.className = this.infDivCssClass;
-
- //custom container
- if (this.toolBarTgtId) {
- _dom.Dom.id(this.toolBarTgtId).appendChild(infdiv);
- }
- //grid-layout
- else if (this.gridLayout) {
- var gridLayout = this.Cpt.gridLayout;
- gridLayout.tblMainCont.appendChild(infdiv);
- infdiv.className = gridLayout.gridInfDivCssClass;
- }
- //default location: just above the table
- else {
- this.tbl.parentNode.insertBefore(infdiv, this.tbl);
- }
- this.infDiv = _dom.Dom.id(this.prfxInfDiv + this.id);
-
- /*** left div containing rows # displayer ***/
- var ldiv = _dom.Dom.create('div', ['id', this.prfxLDiv + this.id]);
- ldiv.className = this.lDivCssClass;
- infdiv.appendChild(ldiv);
- this.lDiv = _dom.Dom.id(this.prfxLDiv + this.id);
-
- /*** right div containing reset button
- + nb results per page select ***/
- var rdiv = _dom.Dom.create('div', ['id', this.prfxRDiv + this.id]);
- rdiv.className = this.rDivCssClass;
- infdiv.appendChild(rdiv);
- this.rDiv = _dom.Dom.id(this.prfxRDiv + this.id);
-
- /*** mid div containing paging elements ***/
- var mdiv = _dom.Dom.create('div', ['id', this.prfxMDiv + this.id]);
- mdiv.className = this.mDivCssClass;
- infdiv.appendChild(mdiv);
- this.mDiv = _dom.Dom.id(this.prfxMDiv + this.id);
-
- // Enable help instructions by default is topbar is generated
- if (!this.helpInstructions) {
- if (!this.Cpt.help) {
- // var Help = require('modules/help').Help;
- // import {Help} from 'modules/help';
- this.Cpt.help = new _Help.Help(this);
- }
- this.Cpt.help.init();
- }
- }
- }, {
- key: 'removeToolbar',
-
- /*====================================================
- - Removes div above table where paging,
- reset button, rows counter label etc. are placed
- =====================================================*/
- value: function removeToolbar() {
- if (!this.infDiv) {
- return;
- }
- this.infDiv.parentNode.removeChild(this.infDiv);
- this.infDiv = null;
- }
- }, {
- key: 'removeExternalFlts',
-
- /*====================================================
- - removes external filters
- =====================================================*/
- value: function removeExternalFlts() {
- if (!this.isExternalFlt && !this.externalFltTgtIds) {
- return;
- }
- for (var ct = 0; ct < this.externalFltTgtIds.length; ct++) {
- var externalFltTgtId = this.externalFltTgtIds[ct],
- externalFlt = _dom.Dom.id(externalFltTgtId);
- if (externalFlt) {
- externalFlt.innerHTML = '';
- }
- }
- }
- }, {
- key: 'setSort',
-
- /*====================================================
- - Sets sorting feature by loading
- WebFX Sortable Table 1.12 plugin by Erik Arvidsson
- and TF adapter by Max Guglielmi
- =====================================================*/
- value: function setSort() {
-
- // require(['adapterSortabletable'], (m)=> {
- // var adapterSortabletable = new m.AdapterSortableTable(this);
- // this.ExtRegistry.sort = adapterSortabletable;
- // adapterSortabletable.init();
- // });
-
- this.loadExtension({
- name: 'adapterSortabletable.js',
- path: './extensions/sortabletable'
- });
- }
- }, {
- key: 'performSort',
- value: function performSort() {
- this.EvtManager(this.Evt.name.sort);
- }
- }, {
- key: 'setEditable',
-
- /*====================================================
- - Sets selection or edition features by loading
- ezEditTable script by Max Guglielmi
- =====================================================*/
- value: function setEditable() {
- var ezEditConfig = this.ezEditTableConfig;
- if (this.isImported(ezEditConfig.src)) {
- this._enableEditable();
- } else {
- this.includeFile(ezEditConfig.name, ezEditConfig.src, this._enableEditable);
- }
- if (ezEditConfig.loadStylesheet && !this.isImported(ezEditConfig.stylesheet, 'link')) {
- this.includeFile(ezEditConfig.stylesheetName, ezEditConfig.stylesheet, null, 'link');
- }
- }
- }, {
- key: 'removeEditable',
-
- /*====================================================
- - Removes selection or edition features
- =====================================================*/
- value: function removeEditable() {
- var ezEditTable = this.ezEditTable;
- if (ezEditTable) {
- if (this.selectable) {
- ezEditTable.Selection.ClearSelections();
- ezEditTable.Selection.Remove();
- }
- if (this.editable) {
- ezEditTable.Editable.Remove();
- }
- }
- }
- }, {
- key: 'resetEditable',
-
- /*====================================================
- - Resets selection or edition features after
- removal
- =====================================================*/
- value: function resetEditable() {
- var ezEditTable = this.ezEditTable;
- if (ezEditTable) {
- if (this.selectable) {
- ezEditTable.Selection.Set();
- }
- if (this.editable) {
- ezEditTable.Editable.Set();
- }
- }
- }
- }, {
- key: '_enableEditable',
- value: function _enableEditable(o) {
- if (!o) {
- o = this;
- }
-
- //start row for EditTable constructor needs to be calculated
- var startRow,
- ezEditConfig = o.ezEditTableConfig,
- thead = _dom.Dom.tag(o.tbl, 'thead');
-
- //if thead exists and startRow not specified, startRow is calculated
- //automatically by EditTable
- if (thead.length > 0 && !ezEditConfig.startRow) {
- startRow = undefined;
- }
- //otherwise startRow config property if any or TableFilter refRow
- else {
- startRow = ezEditConfig.startRow || o.refRow;
- }
-
- ezEditConfig.scroll_into_view = ezEditConfig.scroll_into_view === false ? false : true;
- ezEditConfig.base_path = ezEditConfig.base_path || o.basePath + 'ezEditTable/';
- ezEditConfig.editable = o.editable = o.cfg.editable;
- ezEditConfig.selection = o.selectable = o.cfg.selectable;
-
- if (o.selectable) {
- ezEditConfig.default_selection = ezEditConfig.default_selection || 'row';
- }
- //CSS Styles
- ezEditConfig.active_cell_css = ezEditConfig.active_cell_css || 'ezETSelectedCell';
-
- o._lastValidRowIndex = 0;
- o._lastRowIndex = 0;
-
- if (o.selectable) {
- //Row navigation needs to be calculated according to TableFilter's
- //validRowsIndex array
- var onAfterSelection = function onAfterSelection(et, selectedElm, e) {
- var slc = et.Selection;
- //Next valid filtered row needs to be selected
- var doSelect = function doSelect(nextRowIndex) {
- if (et.defaultSelection === 'row') {
- slc.SelectRowByIndex(nextRowIndex);
- } else {
- et.ClearSelections();
- var cellIndex = selectedElm.cellIndex,
- row = o.tbl.rows[nextRowIndex];
- if (et.defaultSelection === 'both') {
- slc.SelectRowByIndex(nextRowIndex);
- }
- if (row) {
- slc.SelectCell(row.cells[cellIndex]);
- }
- }
- //Table is filtered
- if (o.validRowsIndex.length !== o.getRowsNb()) {
- var r = o.tbl.rows[nextRowIndex];
- if (r) {
- r.scrollIntoView(false);
- }
- if (cell) {
- if (cell.cellIndex === o.getCellsNb() - 1 && o.gridLayout) {
- o.tblCont.scrollLeft = 100000000;
- } else if (cell.cellIndex === 0 && o.gridLayout) {
- o.tblCont.scrollLeft = 0;
- } else {
- cell.scrollIntoView(false);
- }
- }
- }
- };
-
- //table is not filtered
- if (!o.validRowsIndex) {
- return;
- }
- var validIndexes = o.validRowsIndex,
- validIdxLen = validIndexes.length,
- row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm,
-
- //cell for default_selection = 'both' or 'cell'
- cell = selectedElm.nodeName === 'TD' ? selectedElm : null,
- keyCode = e !== undefined ? et.Event.GetKey(e) : 0,
- isRowValid = _array.Arr.has(validIndexes, row.rowIndex),
- nextRowIndex,
-
- //pgup/pgdown keys
- d = keyCode === 34 || keyCode === 33 ? o.pagingLength || et.nbRowsPerPage : 1;
-
- //If next row is not valid, next valid filtered row needs to be
- //calculated
- if (!isRowValid) {
- //Selection direction up/down
- if (row.rowIndex > o._lastRowIndex) {
- //last row
- if (row.rowIndex >= validIndexes[validIdxLen - 1]) {
- nextRowIndex = validIndexes[validIdxLen - 1];
- } else {
- var calcRowIndex = o._lastValidRowIndex + d;
- if (calcRowIndex > validIdxLen - 1) {
- nextRowIndex = validIndexes[validIdxLen - 1];
- } else {
- nextRowIndex = validIndexes[calcRowIndex];
- }
- }
- } else {
- //first row
- if (row.rowIndex <= validIndexes[0]) {
- nextRowIndex = validIndexes[0];
- } else {
- var v = validIndexes[o._lastValidRowIndex - d];
- nextRowIndex = v ? v : validIndexes[0];
- }
- }
- o._lastRowIndex = row.rowIndex;
- doSelect(nextRowIndex);
- } else {
- //If filtered row is valid, special calculation for
- //pgup/pgdown keys
- if (keyCode !== 34 && keyCode !== 33) {
- o._lastValidRowIndex = _array.Arr.indexByValue(validIndexes, row.rowIndex);
- o._lastRowIndex = row.rowIndex;
- } else {
- if (keyCode === 34) {
- //pgdown
- //last row
- if (o._lastValidRowIndex + d <= validIdxLen - 1) {
- nextRowIndex = validIndexes[o._lastValidRowIndex + d];
- } else {
- nextRowIndex = [validIdxLen - 1];
- }
- } else {
- //pgup
- //first row
- if (o._lastValidRowIndex - d <= validIndexes[0]) {
- nextRowIndex = validIndexes[0];
- } else {
- nextRowIndex = validIndexes[o._lastValidRowIndex - d];
- }
- }
- o._lastRowIndex = nextRowIndex;
- o._lastValidRowIndex = _array.Arr.indexByValue(validIndexes, nextRowIndex);
- doSelect(nextRowIndex);
- }
- }
- };
-
- //Page navigation has to be enforced whenever selected row is out of
- //the current page range
- var onBeforeSelection = function onBeforeSelection(et, selectedElm, e) {
- var row = et.defaultSelection !== 'row' ? selectedElm.parentNode : selectedElm;
- if (o.paging) {
- if (o.Cpt.paging.nbPages > 1) {
- var paging = o.Cpt.paging;
- //page length is re-assigned in case it has changed
- et.nbRowsPerPage = paging.pagingLength;
- var validIndexes = o.validRowsIndex,
- validIdxLen = validIndexes.length,
- pagingEndRow = parseInt(paging.startPagingRow, 10) + parseInt(paging.pagingLength, 10);
- var rowIndex = row.rowIndex;
-
- if (rowIndex === validIndexes[validIdxLen - 1] && paging.currentPageNb !== paging.nbPages) {
- paging.setPage('last');
- } else if (rowIndex == validIndexes[0] && paging.currentPageNb !== 1) {
- paging.setPage('first');
- } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) {
- paging.setPage('next');
- } else if (rowIndex < validIndexes[paging.startPagingRow] && rowIndex > validIndexes[0]) {
- paging.setPage('previous');
- }
- }
- }
- };
-
- //Selected row needs to be visible when paging is activated
- if (o.paging) {
- o.onAfterChangePage = function (tf, i) {
- var et = tf.ExtRegistry.ezEditTable;
- var slc = et.Selection;
- var row = slc.GetActiveRow();
- if (row) {
- row.scrollIntoView(false);
- }
- var cell = slc.GetActiveCell();
- if (cell) {
- cell.scrollIntoView(false);
- }
- };
- }
-
- //Rows navigation when rows are filtered is performed with the
- //EditTable row selection callback events
- if (ezEditConfig.default_selection === 'row') {
- var fnB = ezEditConfig.on_before_selected_row;
- ezEditConfig.on_before_selected_row = function () {
- onBeforeSelection(arguments[0], arguments[1], arguments[2]);
- if (fnB) {
- fnB.call(null, arguments[0], arguments[1], arguments[2]);
- }
- };
- var fnA = ezEditConfig.on_after_selected_row;
- ezEditConfig.on_after_selected_row = function () {
- onAfterSelection(arguments[0], arguments[1], arguments[2]);
- if (fnA) {
- fnA.call(null, arguments[0], arguments[1], arguments[2]);
- }
- };
- } else {
- var fnD = ezEditConfig.on_before_selected_cell;
- ezEditConfig.on_before_selected_cell = function () {
- onBeforeSelection(arguments[0], arguments[1], arguments[2]);
- if (fnD) {
- fnD.call(null, arguments[0], arguments[1], arguments[2]);
- }
- };
- var fnC = ezEditConfig.on_after_selected_cell;
- ezEditConfig.on_after_selected_cell = function () {
- onAfterSelection(arguments[0], arguments[1], arguments[2]);
- if (fnC) {
- fnC.call(null, arguments[0], arguments[1], arguments[2]);
- }
- };
- }
- }
- if (o.editable) {
- //Added or removed rows, TF rows number needs to be re-calculated
- var fnE = ezEditConfig.on_added_dom_row;
- ezEditConfig.on_added_dom_row = function () {
- o.nbFilterableRows++;
- if (!o.paging) {
- o.Cpt.rowsCounter.refresh();
- } else {
- o.nbRows++;
- o.nbVisibleRows++;
- o.nbFilterableRows++;
- o.paging = false;
- o.Cpt.paging.destroy();
- o.Cpt.paging.addPaging();
- }
- if (o.alternateBgs) {
- o.Cpt.alternateRows.init();
- }
- if (fnE) {
- fnE.call(null, arguments[0], arguments[1], arguments[2]);
- }
- };
- if (ezEditConfig.actions && ezEditConfig.actions['delete']) {
- var fnF = ezEditConfig.actions['delete'].on_after_submit;
- ezEditConfig.actions['delete'].on_after_submit = function () {
- o.nbFilterableRows--;
- if (!o.paging) {
- o.Cpt.rowsCounter.refresh();
- } else {
- o.nbRows--;
- o.nbVisibleRows--;
- o.nbFilterableRows--;
- o.paging = false;
- o.Cpt.paging.destroy();
- o.Cpt.paging.addPaging(false);
- }
- if (o.alternateBgs) {
- o.Cpt.alternateRows.init();
- }
- if (fnF) {
- fnF.call(null, arguments[0], arguments[1]);
- }
- };
- }
- }
-
- try {
- o.ExtRegistry.ezEditTable = new EditTable(o.id, ezEditConfig, startRow);
- o.ExtRegistry.ezEditTable.Init();
- } catch (e) {
- console.log(ezEditConfig.err);
- }
- }
- }, {
- key: 'resetValues',
-
- /*====================================================
- - IE bug: it seems there is no way to make
- multiple selections programatically, only last
- selection is kept (multiple select previously
- populated via DOM)
- - Work-around: defer selection with a setTimeout
- If you find a more elegant solution to
- this let me know ;-)
- - For the moment only this solution seems to work!
- - Params:
- - slc = select object (select obj)
- - index to be selected (integer)
- - execute filtering (boolean)
- =====================================================*/
- // __deferMultipleSelection: function(slc,index,filter){
- // if(str.lower(slc.nodeName)!=='select'){
- // return;
- // }
- // var doFilter = filter===undefined ? false : filter;
- // var o = this;
- // global.setTimeout(function(){
- // slc.options[0].selected = false;
-
- // if(slc.options[index].value===''){
- // slc.options[index].selected = false;
- // }
- // else{
- // slc.options[index].selected = true;
- // if(doFilter){
- // o.filter();
- // }
- // }
- // }, 0.1);
- // },
-
- /*====================================================
- - Returns an array [[values],[texts]] with
- custom values for a given filter
- - Param: column index (integer)
- =====================================================*/
- // _getCustomValues: function(colIndex){
- // if(!colIndex){
- // return;
- // }
- // //custom select test
- // var isCustomSlc = this.hasCustomSlcOptions &&
- // array.has(this.customSlcOptions.cols, colIndex);
- // if(!isCustomSlc){
- // return;
- // }
- // var optTxt = [], optArray = [];
- // var index = array.indexByValue(this.customSlcOptions.cols, colIndex);
- // var slcValues = this.customSlcOptions.values[index];
- // var slcTexts = this.customSlcOptions.texts[index];
- // var slcSort = this.customSlcOptions.sorts[index];
- // for(var r=0; r= dte2;
- }
- // greater date
- else if (isGDate) {
- dte2 = formatDate(sA.replace(re_g, ''), dtType);
- occurence = dte1 > dte2;
- }
- // different date
- else if (isDFDate) {
- dte2 = formatDate(sA.replace(re_d, ''), dtType);
- occurence = dte1.toString() != dte2.toString();
- }
- // equal date
- else if (isEQDate) {
- dte2 = formatDate(sA.replace(re_eq, ''), dtType);
- occurence = dte1.toString() == dte2.toString();
- }
- // searched keyword with * operator doesn't have to be a date
- else if (re_lk.test(sA)) {
- // like date
- occurence = o._containsStr(sA.replace(re_lk, ''), cell_data, null, false);
- } else if (isValidDate(sA, dtType)) {
- dte2 = formatDate(sA, dtType);
- occurence = dte1.toString() == dte2.toString();
- }
- //empty
- else if (hasEM) {
- occurence = _str.Str.isEmpty(cell_data);
- }
- //non-empty
- else if (hasNM) {
- occurence = !_str.Str.isEmpty(cell_data);
- }
- } else {
- //first numbers need to be formated
- if (o.hasColNbFormat && o.colNbFormat[j]) {
- num_cell_data = removeNbFormat(cell_data, o.colNbFormat[j]);
- nbFormat = o.colNbFormat[j];
- } else {
- if (o.thousandsSeparator === ',' && o.decimalSeparator === '.') {
- num_cell_data = removeNbFormat(cell_data, 'us');
- nbFormat = 'us';
- } else {
- num_cell_data = removeNbFormat(cell_data, 'eu');
- nbFormat = 'eu';
- }
- }
-
- // first checks if there is any operator (<,>,<=,>=,!,*,=,{,},
- // rgx:)
- // lower equal
- if (hasLE) {
- occurence = num_cell_data <= removeNbFormat(sA.replace(re_le, ''), nbFormat);
- }
- //greater equal
- else if (hasGE) {
- occurence = num_cell_data >= removeNbFormat(sA.replace(re_ge, ''), nbFormat);
- }
- //lower
- else if (hasLO) {
- occurence = num_cell_data < removeNbFormat(sA.replace(re_l, ''), nbFormat);
- }
- //greater
- else if (hasGR) {
- occurence = num_cell_data > removeNbFormat(sA.replace(re_g, ''), nbFormat);
- }
- //different
- else if (hasDF) {
- occurence = o._containsStr(sA.replace(re_d, ''), cell_data) ? false : true;
- }
- //like
- else if (hasLK) {
- occurence = o._containsStr(sA.replace(re_lk, ''), cell_data, null, false);
- }
- //equal
- else if (hasEQ) {
- occurence = o._containsStr(sA.replace(re_eq, ''), cell_data, null, true);
- }
- //starts with
- else if (hasST) {
- occurence = cell_data.indexOf(sA.replace(re_st, '')) === 0 ? true : false;
- }
- //ends with
- else if (hasEN) {
- var searchArg = sA.replace(re_en, '');
- occurence = cell_data.lastIndexOf(searchArg, cell_data.length - 1) === cell_data.length - 1 - (searchArg.length - 1) && cell_data.lastIndexOf(searchArg, cell_data.length - 1) > -1 ? true : false;
- }
- //empty
- else if (hasEM) {
- occurence = _str.Str.isEmpty(cell_data);
- }
- //non-empty
- else if (hasNM) {
- occurence = !_str.Str.isEmpty(cell_data);
- }
- //regexp
- else if (hasRE) {
- //in case regexp fires an exception
- try {
- //operator is removed
- var srchArg = sA.replace(re_re, '');
- var rgx = new RegExp(srchArg);
- occurence = rgx.test(cell_data);
- } catch (e) {
- occurence = false;
- }
- } else {
- var fCol = f['col_' + j];
- occurence = o._containsStr(sA, cell_data, !fCol ? o.fltTypeInp : fCol);
- }
- } //else
- return occurence;
- } //fn
-
- for (var k = this.refRow; k < this.nbRows; k++) {
- /*** if table already filtered some rows are not visible ***/
- if (row[k].style.display === 'none') {
- row[k].style.display = '';
- }
-
- var cell = row[k].cells,
- nchilds = cell.length;
-
- // checks if row has exact cell #
- if (nchilds !== this.nbCells) {
- continue;
- }
-
- var occurence = [],
- isRowValid = this.searchType === 'include' ? true : false,
-
- //only for single filter search
- singleFltRowValid = false;
-
- // this loop retrieves cell data
- for (var j = 0; j < nchilds; j++) {
- //searched keyword
- var sA = this.searchArgs[this.singleSearchFlt ? 0 : j],
- dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType;
- if (sA === '') {
- continue;
- }
-
- var cell_data = _str.Str.matchCase(this.getCellData(j, cell[j]), this.matchCase);
-
- //multiple search parameter operator ||
- var sAOrSplit = sA.split(this.orOperator),
-
- //multiple search || parameter boolean
- hasMultiOrSA = sAOrSplit.length > 1 ? true : false,
-
- //multiple search parameter operator &&
- sAAndSplit = sA.split(this.anOperator),
-
- //multiple search && parameter boolean
- hasMultiAndSA = sAAndSplit.length > 1 ? true : false;
-
- //multiple sarch parameters
- if (hasMultiOrSA || hasMultiAndSA) {
- var cS,
- occur = false,
- s = hasMultiOrSA ? sAOrSplit : sAAndSplit;
- for (var w = 0; w < s.length; w++) {
- cS = _str.Str.trim(s[w]);
- occur = hasArg(cS, cell_data, j);
- highlight(cS, occur, cell[j]);
- if (hasMultiOrSA && occur) {
- break;
- }
- if (hasMultiAndSA && !occur) {
- break;
- }
- }
- occurence[j] = occur;
- }
- //single search parameter
- else {
- occurence[j] = hasArg(_str.Str.trim(sA), cell_data, j);
- highlight(sA, occurence[j], cell[j]);
- } //else single param
-
- if (!occurence[j]) {
- isRowValid = this.searchType === 'include' ? false : true;
- }
- if (this.singleSearchFlt && occurence[j]) {
- singleFltRowValid = true;
- }
- if (this.popUpFilters) {
- this.Cpt.popupFilter.buildIcon(j, true);
- }
- if (this.markActiveColumns) {
- if (k === this.refRow) {
- if (this.onBeforeActiveColumn) {
- this.onBeforeActiveColumn.call(null, this, j);
- }
- _dom.Dom.addClass(this.getHeaderElement(j), this.activeColumnsCssClass);
- if (this.onAfterActiveColumn) {
- this.onAfterActiveColumn.call(null, this, j);
- }
- }
- }
- } //for j
-
- if (this.singleSearchFlt && singleFltRowValid) {
- isRowValid = true;
- }
-
- if (!isRowValid) {
- this.validateRow(k, false);
- // always visible rows need to be counted as valid
- if (this.hasVisibleRows && _array.Arr.has(this.visibleRows, k) && !this.paging) {
- this.validRowsIndex.push(k);
- } else {
- hiddenrows++;
- }
- } else {
- this.validateRow(k, true);
- this.validRowsIndex.push(k);
- if (this.alternateBgs) {
- this.Cpt.alternateRows.setRowBg(k, this.validRowsIndex.length);
- }
- if (this.onRowValidated) {
- this.onRowValidated.call(null, this, k);
- }
- }
- } // for k
-
- this.nbVisibleRows = this.validRowsIndex.length;
- this.nbHiddenRows = hiddenrows;
- this.isStartBgAlternate = false;
-
- if (this.rememberGridValues) {
- this.Cpt.store.saveFilterValues(this.fltsValuesCookie);
- }
- //applies filter props after filtering process
- if (!this.paging) {
- this.applyGridProps();
- } else {
- this.startPagingRow = 0;
- this.currentPageNb = 1;
- this.Cpt.paging.setPagingInfo(this.validRowsIndex);
- } //starts paging process
- //invokes onafter callback
- if (this.onAfterFilter) {
- this.onAfterFilter.call(null, this);
- }
- }
- }, {
- key: 'applyGridProps',
-
- /*====================================================
- - checks methods that should be called
- after filtering and/or paging process
- =====================================================*/
- value: function applyGridProps() {
- // blurs active filter (IE)
- if (this.activeFlt && _str.Str.lower(this.activeFlt.nodeName) === this.fltTypeSlc && !this.popUpFilters) {
- this.activeFlt.blur();
- if (this.activeFlt.parentNode) {
- this.activeFlt.parentNode.focus();
- }
- }
-
- //shows rows always visible
- if (this.visibleRows) {
- this.enforceVisibility();
- }
- //makes operation on a col
- if (this.hasColOperation) {
- this.Cpt.colOps.calc();
- }
- //re-populates drop-down filters
- if (this.linkedFilters) {
- this.linkFilters();
- }
- var nr = !this.paging && this.hasVisibleRows ? this.nbVisibleRows - this.visibleRows.length : this.nbVisibleRows;
- //refreshes rows counter
- if (this.rowsCounter) {
- this.Cpt.rowsCounter.refresh(nr);
- }
-
- if (this.popUpFilters) {
- this.Cpt.popupFilter.closeAll();
- }
- }
- }, {
- key: 'getColValues',
-
- /*====================================================
- - returns an array containing cell values of
- a column
- - needs following args:
- - column index (number)
- - a boolean set to true if we want only
- numbers to be returned
- - array containing rows index to be excluded
- from returned values
- =====================================================*/
- value: function getColValues(colindex, num, exclude) {
- if (!this.fltGrid) {
- return;
- }
- var row = this.tbl.rows,
- colValues = [];
-
- for (var i = this.refRow; i < this.nbRows; i++) {
- var isExludedRow = false;
- // checks if current row index appears in exclude array
- if (exclude && _types.Types.isArray(exclude)) {
- isExludedRow = _array.Arr.has(exclude, i); //boolean
- }
- var cell = row[i].cells,
- nchilds = cell.length;
-
- // checks if row has exact cell # and is not excluded
- if (nchilds == this.nbCells && !isExludedRow) {
- // this loop retrieves cell data
- for (var j = 0; j < nchilds; j++) {
- if (j === colindex && row[i].style.display === '') {
- var cell_data = _str.Str.lower(this.getCellData(j, cell[j])),
- nbFormat = this.colNbFormat ? this.colNbFormat[colindex] : null,
- data = num ? removeNbFormat(cell_data, nbFormat) : cell_data;
- colValues.push(data);
- }
- }
- }
- } //for i
- return colValues;
- }
- }, {
- key: 'getFilterValue',
-
- /*====================================================
- - Returns value of a specified filter
- - Params:
- - index: filter column index (numeric value)
- =====================================================*/
- value: function getFilterValue(index) {
- if (!this.fltGrid) {
- return;
- }
- var fltValue,
- flt = this.getFilterElement(index);
- if (!flt) {
- return '';
- }
- var fltColType = this.fltCol[index];
- if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) {
- fltValue = flt.value;
- }
- //mutiple select
- else if (fltColType === this.fltTypeMulti) {
- fltValue = '';
- for (var j = 0; j < flt.options.length; j++) {
- if (flt.options[j].selected) {
- fltValue = fltValue.concat(flt.options[j].value + ' ' + this.orOperator + ' ');
- }
- }
- //removes last operator ||
- fltValue = fltValue.substr(0, fltValue.length - 4);
- }
- //checklist
- else if (fltColType === this.fltTypeCheckList) {
- if (flt.getAttribute('value') !== null) {
- fltValue = flt.getAttribute('value');
- //removes last operator ||
- fltValue = fltValue.substr(0, fltValue.length - 3);
- } else {
- fltValue = '';
- }
- }
- return fltValue;
- }
- }, {
- key: 'getFiltersValue',
-
- /*====================================================
- - Returns the value of every single filter
- =====================================================*/
- value: function getFiltersValue() {
- if (!this.fltGrid) {
- return;
- }
- var searchArgs = [];
- for (var i = 0; i < this.fltIds.length; i++) {
- searchArgs.push(_str.Str.trim(_str.Str.matchCase(this.getFilterValue(i), this.matchCase)));
- }
- return searchArgs;
- }
- }, {
- key: 'getFilterId',
-
- /*====================================================
- - Returns filter id of a specified column
- - Params:
- - index: column index (numeric value)
- =====================================================*/
- value: function getFilterId(index) {
- if (!this.fltGrid) {
- return;
- }
- return this.fltIds[i];
- }
- }, {
- key: 'getFiltersByType',
-
- /*====================================================
- - returns an array containing ids of filters of a
- specified type (inputs or selects)
- - Note that hidden filters are also returned
- - Needs folllowing args:
- - filter type string ('input','select',
- 'multiple')
- - optional boolean: if set true method
- returns column indexes otherwise filters ids
- =====================================================*/
- value: function getFiltersByType(type, bool) {
- if (!this.fltGrid) {
- return;
- }
- var arr = [];
- for (var i = 0; i < this.fltIds.length; i++) {
- var fltType = this['col' + i];
- if (fltType === _str.Str.lower(type)) {
- var a = bool ? i : this.fltIds[i];
- arr.push(a);
- }
- }
- return arr;
- }
- }, {
- key: 'getFilterElement',
-
- /*====================================================
- - returns filter DOM element for a given column
- index
- =====================================================*/
- value: function getFilterElement(index) {
- if (!this.fltGrid) {
- return null;
- }
- return _dom.Dom.id(this.fltIds[index]);
- }
- }, {
- key: 'getCellsNb',
-
- /*====================================================
- - returns number of cells in a row
- - if rowIndex param is passed returns number of
- cells of specified row (number)
- =====================================================*/
- value: function getCellsNb(rowIndex) {
- var tr = !rowIndex ? this.tbl.rows[0] : this.tbl.rows[rowIndex];
- return tr.cells.length;
- }
- }, {
- key: 'getRowsNb',
-
- /*====================================================
- - returns total nb of filterable rows starting
- from reference row if defined
- - Param:
- - includeHeaders: if true header rows are
- included in calculation(= table rows number)
- =====================================================*/
- value: function getRowsNb(includeHeaders) {
- var s = !this.refRow ? 0 : this.refRow,
- ntrs = this.tbl.rows.length;
- if (includeHeaders) {
- s = 0;
- }
- return parseInt(ntrs - s, 10);
- }
- }, {
- key: 'getCellData',
-
- /*====================================================
- - returns text content of a given cell
- - Params:
- - i: index of the column (number)
- - cell: td DOM object
- =====================================================*/
- value: function getCellData(i, cell) {
- if (i === undefined || !cell) {
- return '';
- }
- //First checks for customCellData event
- if (this.customCellData && _array.Arr.has(this.customCellDataCols, i)) {
- return this.customCellData.call(null, this, cell, i);
- } else {
- return _dom.Dom.getText(cell);
- }
- }
- }, {
- key: 'getTableData',
-
- /*====================================================
- - returns an array containing table data:
- [rowindex,[value1,value2,value3...]]
- =====================================================*/
- value: function getTableData() {
- var row = this.tbl.rows;
- for (var k = this.refRow; k < this.nbRows; k++) {
- var rowData = [k, []];
- var cells = row[k].cells;
- // this loop retrieves cell data
- for (var j = 0; j < cells.length; j++) {
- var cell_data = this.getCellData(j, cells[j]);
- rowData[1].push(cell_data);
- }
- this.tblData.push(rowData);
- }
- return this.tblData;
- }
- }, {
- key: 'getFilteredData',
-
- /*====================================================
- - returns an array containing filtered data:
- [rowindex,[value1,value2,value3...]]
- =====================================================*/
- value: function getFilteredData(includeHeaders) {
- if (!this.validRowsIndex) {
- return [];
- }
- var row = this.tbl.rows,
- filteredData = [];
- if (includeHeaders) {
- var table = this.gridLayout ? this.Cpt.gridLayout.headTbl : this.tbl,
- r = table.rows[this.headersRow],
- rowData = [r.rowIndex, []];
- for (var j = 0; j < this.nbCells; j++) {
- var headerText = this.getCellData(j, r.cells[j]);
- rowData[1].push(headerText);
- }
- filteredData.push(rowData);
- }
-
- var validRows = this.getValidRowsIndex(true);
- for (var i = 0; i < validRows.length; i++) {
- var rData = [this.validRowsIndex[i], []],
- cells = row[this.validRowsIndex[i]].cells;
- for (var k = 0; k < cells.length; k++) {
- var cell_data = this.getCellData(k, cells[k]);
- rData[1].push(cell_data);
- }
- filteredData.push(rData);
- }
- return filteredData;
- }
- }, {
- key: 'getFilteredDataCol',
-
- /*====================================================
- - returns an array containing filtered data of a
- specified column.
- - Params:
- - colIndex: index of the column (number)
- - returned array:
- [value1,value2,value3...]
- =====================================================*/
- value: function getFilteredDataCol(colIndex) {
- if (colIndex === undefined) {
- return [];
- }
- var data = this.getFilteredData(),
- colData = [];
- for (var i = 0; i < data.length; i++) {
- var r = data[i],
-
- //cols values of current row
- d = r[1],
-
- //data of searched column
- c = d[colIndex];
- colData.push(c);
- }
- return colData;
- }
- }, {
- key: 'getRowDisplay',
- value: function getRowDisplay(row) {
- if (!this.fltGrid && !_types.Types.isObj(row)) {
- return;
- }
- return row.style.display;
- }
- }, {
- key: 'validateRow',
-
- /*====================================================
- - Validates/unvalidates row by setting 'validRow'
- attribute and shows/hides row
- - Params:
- - rowIndex: index of the row (number)
- - isValid: boolean
- =====================================================*/
- value: function validateRow(rowIndex, isValid) {
- var row = this.tbl.rows[rowIndex];
- if (!row || _str.Str.lower(typeof isValid) !== 'boolean') {
- return;
- }
-
- // always visible rows are valid
- if (this.hasVisibleRows && _array.Arr.has(this.visibleRows, rowIndex) && !this.paging) {
- isValid = true;
- }
-
- var displayFlag = isValid ? '' : 'none',
- validFlag = isValid ? 'true' : 'false';
- row.style.display = displayFlag;
-
- if (this.paging) {
- row.setAttribute('validRow', validFlag);
- }
- }
- }, {
- key: 'validateAllRows',
-
- /*====================================================
- - Validates all filterable rows
- =====================================================*/
- value: function validateAllRows() {
- if (!this._hasGrid) {
- return;
- }
- this.validRowsIndex = [];
- for (var k = this.refRow; k < this.nbFilterableRows; k++) {
- this.validateRow(k, true);
- this.validRowsIndex.push(k);
- }
- }
- }, {
- key: 'setFilterValue',
-
- /*====================================================
- - Inserts value in a specified filter
- - Params:
- - index: filter column index (numeric value)
- - searcharg: search string
- - doFilter: optional boolean for multiple
- selects: executes filtering when multiple
- select populated... IE only!
- =====================================================*/
- value: function setFilterValue(index, searcharg, doFilter) {
- if (!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)) {
- return;
- }
- var slc = this.getFilterElement(index),
- execFilter = doFilter === undefined ? true : doFilter,
- fltColType = this['col' + index];
- searcharg = searcharg === undefined ? '' : searcharg;
-
- if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) {
- slc.value = searcharg;
- }
- //multiple selects
- else if (fltColType === this.fltTypeMulti) {
- var s = searcharg.split(' ' + this.orOperator + ' '),
- ct = 0; //keywords counter
- for (var j = 0; j < slc.options.length; j++) {
- if (s === '' || s[0] === '') {
- slc.options[j].selected = false;
- }
- if (slc.options[j].value === '') {
- slc.options[j].selected = false;
- }
- if (slc.options[j].value !== '' && _array.Arr.has(s, slc.options[j].value, true)) {
- // IE multiple selection work-around
- // if(hlp.isIE()){
- // //when last value reached filtering can be executed
- // var filter = ct==(s.length-1) && execFilter ?
- // true : false;
- // this.__deferMultipleSelection(slc,j,filter);
- // ct++;
- // }
- // else{
- // slc.options[j].selected = true;
- // }
- slc.options[j].selected = true;
- } //if
- } //for j
- }
- //checklist
- else if (fltColType === this.fltTypeCheckList) {
- searcharg = _str.Str.matchCase(searcharg, this.matchCase);
- var sarg = searcharg.split(' ' + this.orOperator + ' '),
- fltValue = slc.setAttribute('value', ''),
- fltIndex = slc.setAttribute('indexes', '');
- for (var k = 0; k < _dom.Dom.tag(slc, 'li').length; k++) {
- var li = _dom.Dom.tag(slc, 'li')[k],
- lbl = _dom.Dom.tag(li, 'label')[0],
- chk = _dom.Dom.tag(li, 'input')[0],
- lblTxt = _str.Str.matchCase(_dom.Dom.getText(lbl), this.matchCase);
- if (lblTxt !== '' && _array.Arr.has(sarg, lblTxt, true)) {
- chk.checked = true;
- this.Cpt.checkList.setCheckListValues(chk);
- } else {
- chk.checked = false;
- this.Cpt.checkList.setCheckListValues(chk);
- }
- }
- }
- }
- }, {
- key: 'setColWidths',
-
- /*====================================================
- - sets coluun widths in pixels
- =====================================================*/
- value: function setColWidths(rowIndex) {
- if (!this.fltGrid || !this.hasColWidth) {
- return;
- }
- var o = this,
- rIndex;
- if (rowIndex === undefined) {
- rIndex = this.tbl.rows[0].style.display != 'none' ? 0 : 1;
- } else {
- rIndex = rowIndex;
- }
- setWidths(this.tbl.rows[rIndex]);
-
- function setWidths(row) {
- if (!o && o.nbCells != o.colWidth.length) {
- return;
- }
- if (o.nbCells == row.cells.length) {
- for (var k = 0; k < o.nbCells; k++) {
- row.cells[k].style.width = o.colWidth[k];
- }
- }
- }
- }
- }, {
- key: 'enforceVisibility',
-
- /*====================================================
- - makes a row always visible
- - Note this works only if paging is false
- =====================================================*/
- value: function enforceVisibility() {
- if (this._hasGrid && this.hasVisibleRows && !this.paging) {
- for (var i = 0; i < this.visibleRows.length; i++) {
- //row index cannot be > nrows
- if (this.visibleRows[i] <= this.nbRows) {
- this.validateRow(this.visibleRows[i], true);
- }
- }
- }
- }
- }, {
- key: 'clearFilters',
- value: function clearFilters() {
- this.EvtManager(this.Evt.name.clear);
- }
- }, {
- key: '_clearFilters',
-
- /*====================================================
- - clears grid filters
- =====================================================*/
- value: function _clearFilters() {
- if (!this.fltGrid) {
- return;
- }
- if (this.onBeforeReset) {
- this.onBeforeReset.call(null, this, this.getFiltersValue());
- }
- for (var i = 0; i < this.fltIds.length; i++) {
- this.setFilterValue(i, '');
- }
- if (this.linkedFilters) {
- this.activeFilterId = '';
- this.linkFilters();
- }
- if (this.rememberPageLen) {
- _cookie.Cookie.remove(this.pgLenCookie);
- }
- if (this.rememberPageNb) {
- _cookie.Cookie.remove(this.pgNbCookie);
- }
- if (this.onAfterReset) {
- this.onAfterReset.call(null, this);
- }
- }
- }, {
- key: 'clearActiveColumns',
-
- /*====================================================
- - clears active columns header class name
- =====================================================*/
- value: function clearActiveColumns() {
- for (var i = 0; i < this.fltIds.length; i++) {
- _dom.Dom.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass);
- }
- }
- }, {
- key: 'refresh',
-
- /*====================================================
- - Re-generates filters grid
- =====================================================*/
- value: function refresh(config) {
- var configObj = !config ? this.cfg : config;
- var hasSort = this.sort;
- //sort property is set to false in order to avoid sort object
- //re-instanciation
- if (hasSort) {
- this.sort = false;
- }
- this.nbRows = this.getRowsNb(); //in case table is refreshed
- this.remove();
- window['tf_' + this.id] = new TableFilter(this.id, this.startRow, configObj);
- this.isFirstLoad = true;
- this.fltIds = [];
- this.init();
- //New tbody content needs to be referenced in sortabletable script with
- //setTBody() method
- if (hasSort) {
- //this.st = SortableTable object
- //Note this is a method of the Sortable Table 1.12 script
- //(Erik Arvidsson)
- this.st.setTBody(this.tbl.tBodies[0]);
- //finally sort property is enabled again
- this.sort = true;
- }
- }
- }, {
- key: 'linkFilters',
-
- /*====================================================
- - retrieves select, multiple and checklist filters
- - calls method repopulating filters
- =====================================================*/
- value: function linkFilters() {
- var slcA1 = this.getFiltersByType(this.fltTypeSlc, true),
- slcA2 = this.getFiltersByType(this.fltTypeMulti, true),
- slcA3 = this.getFiltersByType(this.fltTypeCheckList, true),
- slcIndex = slcA1.concat(slcA2);
- slcIndex = slcIndex.concat(slcA3);
-
- if (this.activeFilterId) {
- var activeFlt = this.activeFilterId.split('_')[0];
- activeFlt = activeFlt.split(this.prfxFlt)[1];
- var slcSelectedValue;
- for (var i = 0; i < slcIndex.length; i++) {
- var curSlc = _dom.Dom.id(this.fltIds[slcIndex[i]]);
- slcSelectedValue = this.getFilterValue(slcIndex[i]);
- if (activeFlt !== slcIndex[i] || this.paging && _array.Arr.has(slcA1, slcIndex[i]) && activeFlt === slcIndex[i] || !this.paging && (_array.Arr.has(slcA3, slcIndex[i]) || _array.Arr.has(slcA2, slcIndex[i])) || slcSelectedValue === this.displayAllText) {
-
- if (_array.Arr.has(slcA3, slcIndex[i])) {
- this.Cpt.checkList.checkListDiv[slcIndex[i]].innerHTML = '';
- } else {
- curSlc.innerHTML = '';
- }
-
- //1st option needs to be inserted
- if (this.fillSlcOnDemand) {
- var opt0 = _dom.Dom.createOpt(this.displayAllText, '');
- if (curSlc) {
- curSlc.appendChild(opt0);
- }
- }
-
- if (_array.Arr.has(slcA3, slcIndex[i])) {
- this.Cpt.checkList._build(slcIndex[i]);
- } else {
- this.Cpt.dropdown._build(slcIndex[i], true);
- }
-
- this.setFilterValue(slcIndex[i], slcSelectedValue);
- }
- } // for i
- }
- }
- }, {
- key: '_resetGrid',
-
- /*====================================================
- - Private methods
- =====================================================*/
-
- /*====================================================
- - Only used by AddGrid() method
- - Resets filtering grid bar if previously removed
- =====================================================*/
- value: function _resetGrid() {
- if (this.isFirstLoad) {
- return;
- }
-
- // grid was removed, grid row element is stored in fltGridEl property
- if (!this.gridLayout) {
- this.tbl.rows[this.filtersRowIndex].parentNode.insertBefore(this.fltGridEl, this.tbl.rows[this.filtersRowIndex]);
- }
-
- // filters are appended in external placeholders elements
- if (this.isExternalFlt) {
- for (var ct = 0; ct < this.externalFltTgtIds.length; ct++) {
- var extFlt = _dom.Dom.id(this.externalFltTgtIds[ct]);
- if (extFlt) {
- extFlt.appendChild(this.externalFltEls[ct]);
- var colFltType = this['col' + ct];
- //IE special treatment for gridLayout, appended filters are
- //empty
- if (this.gridLayout && this.externalFltEls[ct].innerHTML === '' && colFltType !== this.fltTypeInp) {
- if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) {
- this.Cpt.dropdown.build(ct);
- }
- if (colFltType === this.fltTypeCheckList) {
- this.Cpt.checkList.build(ct);
- }
- }
- }
- }
- }
-
- this.nbFilterableRows = this.getRowsNb();
- this.nbVisibleRows = this.nbFilterableRows;
- this.nbRows = this.tbl.rows.length;
- if (this.isSortEnabled) {
- this.sort = true;
- }
-
- if (this.tbl.rows[this.filtersRowIndex].innerHTML === '') {
- refreshFilters(this);
- } else {
- if (this.popUpFilters) {
- this.headersRow++;
- this.Cpt.popupFilter.buildAll();
- }
- }
-
- /*** ie bug work-around, filters need to be re-generated since row
- is empty; insertBefore method doesn't seem to work properly
- with previously generated DOM nodes modified by innerHTML ***/
- function refreshFilters(o) {
- o.tbl.deleteRow(o.filtersRowIndex);
- o.remove();
- o.fltIds = [];
- o.isFirstLoad = true;
- if (o.popUpFilters) {
- // o.RemovePopupFilters();
- o.Cpt.popupFilter.destroy();
- }
- o._AddGrid();
- }
-
- if (!this.gridLayout) {
- _dom.Dom.addClass(this.tbl, this.prfxTf);
- }
- this._hasGrid = true;
- }
- }, {
- key: '_containsStr',
-
- /*==============================================
- - Checks if data contains searched arg,
- returns a boolean
- - Params:
- - arg: searched string
- - data: data string
- - fltType: filter type (string,
- exact match by default for selects -
- optional)
- - forceMatch: boolean forcing exact
- match (optional)
- ===============================================*/
- value: function _containsStr(arg, data, fltType, forceMatch) {
- // Improved by Cedric Wartel (cwl)
- // automatic exact match for selects and special characters are now
- // filtered
- var regexp,
- modifier = this.matchCase ? 'g' : 'gi',
- exactMatch = !forceMatch ? this.exactMatch : forceMatch;
- if (exactMatch || fltType !== this.fltTypeInp && fltType) {
- regexp = new RegExp('(^\\s*)' + _str.Str.rgxEsc(arg) + '(\\s*$)', modifier);
- } else {
- regexp = new RegExp(_str.Str.rgxEsc(arg), modifier);
- }
- return regexp.test(data);
- }
- }, {
- key: 'isImported',
- value: function isImported(filePath, type) {
- var imported = false,
- importType = !type ? 'script' : type,
- attr = importType == 'script' ? 'src' : 'href',
- files = _dom.Dom.tag(doc, importType);
- for (var i = 0; i < files.length; i++) {
- if (files[i][attr] === undefined) {
- continue;
- }
- if (files[i][attr].match(filePath)) {
- imported = true;
- break;
- }
- }
- return imported;
- }
- }, {
- key: 'includeFile',
- value: function includeFile(fileId, filePath, callback, type) {
- var ftype = !type ? 'script' : type,
- imported = this.isImported(filePath, ftype);
- if (imported) {
- return;
- }
- var o = this,
- isLoaded = false,
- file,
- head = _dom.Dom.tag(doc, 'head')[0];
-
- if (_str.Str.lower(ftype) === 'link') {
- file = _dom.Dom.create('link', ['id', fileId], ['type', 'text/css'], ['rel', 'stylesheet'], ['href', filePath]);
- } else {
- file = _dom.Dom.create('script', ['id', fileId], ['type', 'text/javascript'], ['src', filePath]);
- }
-
- //Browser <> IE onload event works only for scripts, not for stylesheets
- file.onload = file.onreadystatechange = function () {
- if (!isLoaded && (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) {
- isLoaded = true;
- if (typeof callback === 'function') {
- callback.call(null, o);
- }
- }
- };
- file.onerror = function () {
- throw new Error('TF script could not load: ' + filePath);
- };
- head.appendChild(file);
- }
- }, {
- key: 'hasGrid',
-
- /*====================================================
- - checks if table has a filter grid
- - returns a boolean
- =====================================================*/
- value: function hasGrid() {
- return this._hasGrid;
- }
- }, {
- key: 'getFiltersId',
-
- /*====================================================
- - returns an array containing filters ids
- - Note that hidden filters are also returned
- =====================================================*/
- value: function getFiltersId() {
- if (!this._hasGrid) {
- return;
- }
- return this.fltIds;
- }
- }, {
- key: 'getValidRowsIndex',
-
- /*====================================================
- - returns an array containing valid rows indexes
- (valid rows upon filtering)
- =====================================================*/
- value: function getValidRowsIndex(reCalc) {
- if (!this._hasGrid) {
- return;
- }
- if (!reCalc) {
- return this.validRowsIndex;
- }
-
- this.validRowsIndex = [];
- for (var k = this.refRow; k < this.getRowsNb(true); k++) {
- var r = this.tbl.rows[k];
- if (!this.paging) {
- if (this.getRowDisplay(r) !== 'none') {
- this.validRowsIndex.push(r.rowIndex);
- }
- } else {
- if (r.getAttribute('validRow') === 'true' || r.getAttribute('validRow') === null) {
- this.validRowsIndex.push(r.rowIndex);
- }
- }
- }
- return this.validRowsIndex;
- }
- }, {
- key: 'getFiltersRowIndex',
-
- /*====================================================
- - Returns the index of the row containing the
- filters
- =====================================================*/
- value: function getFiltersRowIndex() {
- if (!this._hasGrid) {
- return;
- }
- return this.filtersRowIndex;
- }
- }, {
- key: 'getHeadersRowIndex',
-
- /*====================================================
- - Returns the index of the headers row
- =====================================================*/
- value: function getHeadersRowIndex() {
- if (!this._hasGrid) {
- return;
- }
- return this.headersRow;
- }
- }, {
- key: 'getStartRowIndex',
-
- /*====================================================
- - Returns the index of the row from which will
- start the filtering process (1st filterable row)
- =====================================================*/
- value: function getStartRowIndex() {
- if (!this._hasGrid) {
- return;
- }
- return this.refRow;
- }
- }, {
- key: 'getLastRowIndex',
-
- /*====================================================
- - Returns the index of the last row
- =====================================================*/
- value: function getLastRowIndex() {
- if (!this._hasGrid) {
- return;
- }
- return this.nbRows - 1;
- }
- }, {
- key: 'getHeaderElement',
-
- /*====================================================
- - returns a header DOM element for a given column
- index
- =====================================================*/
- value: function getHeaderElement(colIndex) {
- var table = this.gridLayout ? this.Cpt.gridLayout.headTbl : this.tbl;
- var tHead = _dom.Dom.tag(table, 'thead');
- var headersRow = this.headersRow;
- var header;
- for (var i = 0; i < this.nbCells; i++) {
- if (i !== colIndex) {
- continue;
- }
- if (tHead.length === 0) {
- header = table.rows[headersRow].cells[i];
- }
- if (tHead.length === 1) {
- header = tHead[0].rows[headersRow].cells[i];
- }
- break;
- }
- return header;
- }
- }, {
- key: 'config',
-
- /*====================================================
- - returns the original configuration object
- =====================================================*/
- value: function config() {
- return this.cfg;
- }
- }, {
- key: 'getFilterableRowsNb',
-
- /*====================================================
- - returns the total number of rows that can be
- filtered
- =====================================================*/
- value: function getFilterableRowsNb() {
- return this.getRowsNb(false);
- }
- }]);
-
- return TableFilter;
- })();
-
- exports.TableFilter = TableFilter;
-
- function removeNbFormat(data, format) {
- if (!data) {
- return;
- }
- if (!format) {
- format = 'us';
- }
- var n = data;
- if (_str.Str.lower(format) === 'us') {
- n = +n.replace(/[^\d\.-]/g, '');
- } else {
- n = +n.replace(/[^\d\,-]/g, '').replace(',', '.');
- }
- return n;
- }
-
- // function isStylesheetImported(stylesheet){
- // var isImported = false;
- // if(!doc.styleSheets){
- // return isImported;
- // }
- // var s = doc.styleSheets,
- // regexp = new RegExp(stylesheet);
- // for(var i=0; i]+>/g, '');
- s = s.replace(/^\s+/, '').replace(/\s+$/, '');
- return s;
- };
-
- /**
- * Creates an html element with given collection of attributes
- * @param {String} tag a string of the html tag to create
- * @param {Array} an undetermined number of arrays containing the with 2
- * items, the attribute name and its value ['id','myId']
- * @return {Object} created element
- */
- Dom.create = function (tag) {
- if (!tag || tag === '') {
- return;
- }
-
- var el = document.createElement(tag),
- args = arguments;
-
- if (args.length > 1) {
- for (var i = 0; i < args.length; i++) {
- var argtype = typeof args[i];
- if (argtype.toLowerCase() === 'object' && args[i].length === 2) {
- el.setAttribute(args[i][0], args[i][1]);
- }
- }
- }
- return el;
- };
-
- /**
- * Returns a text node with given text
- * @param {String} text
- * @return {Object}
- */
- Dom.text = function (text) {
- return document.createTextNode(text);
- };
-
- /**
- * Returns offset position of passed element
- * @param {object} obj [description]
- * @return {object} literal object with left and top values
- */
- Dom.position = function (obj) {
- var l = 0,
- t = 0;
- if (obj && obj.offsetParent) {
- do {
- l += obj.offsetLeft;
- t += obj.offsetTop;
- } while (obj == obj.offsetParent);
- }
- return { left: l, top: t };
- };
-
- Dom.hasClass = function (ele, cls) {
- if (!ele) {
- return false;
- }
-
- if (supportsClassList()) {
- return ele.classList.contains(cls);
- }
- return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
- };
-
- Dom.addClass = function (ele, cls) {
- if (!ele) {
- return;
- }
-
- if (supportsClassList()) {
- ele.classList.add(cls);
- return;
- }
-
- if (ele.className === '') {
- ele.className = cls;
- } else if (!this.hasClass(ele, cls)) {
- ele.className += ' ' + cls;
- }
- };
-
- Dom.removeClass = function (ele, cls) {
- if (!ele) {
- return;
- }
-
- if (supportsClassList()) {
- ele.classList.remove(cls);
- return;
- }
- var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)', 'g');
- ele.className = ele.className.replace(reg, '');
- };
-
- /**
- * Creates and returns an option element
- * @param {String} text option text
- * @param {String} value option value
- * @param {Boolean} isSel whether option is selected
- * @return {Object} option element
- */
- Dom.createOpt = function (text, value, isSel) {
- var isSelected = isSel ? true : false,
- opt = isSelected ? this.create('option', ['value', value], ['selected', 'true']) : this.create('option', ['value', value]);
- opt.appendChild(this.text(text));
- return opt;
- };
-
- /**
- * Creates and returns a checklist item
- * @param {Number} chkIndex index of check item
- * @param {String} chkValue check item value
- * @param {String} labelText check item label text
- * @return {Object} li DOM element
- */
- Dom.createCheckItem = function (chkIndex, chkValue, labelText) {
- var li = this.create('li'),
- label = this.create('label', ['for', chkIndex]),
- check = this.create('input', ['id', chkIndex], ['name', chkIndex], ['type', 'checkbox'], ['value', chkValue]);
- label.appendChild(check);
- label.appendChild(this.text(labelText));
- li.appendChild(label);
- li.label = label;
- li.check = check;
- return li;
- };
-
- Dom.id = function (id) {
- return document.getElementById(id);
- };
-
- Dom.tag = function (o, tagname) {
- return o.getElementsByTagName(tagname);
- };
-
- // HTML5 classList API
- function supportsClassList() {
- return document.documentElement.classList;
- }
-
- exports.Dom = Dom;
-
-/***/ },
-/* 4 */
-/***/ function(module, exports, __webpack_require__) {
-
- /**
- * String utilities
- */
-
- 'use strict';
-
- var Str = {};
-
- Str.lower = function (text) {
- return text.toLowerCase();
- };
-
- Str.upper = function (text) {
- return text.toUpperCase();
- };
-
- Str.trim = function (text) {
- if (text.trim) {
- return text.trim();
- }
- return text.replace(/^\s*|\s*$/g, '');
- };
-
- Str.isEmpty = function (text) {
- return this.trim(text) === '';
- };
-
- Str.rgxEsc = function (text) {
- function escape(e) {
- var a = new RegExp('\\' + e, 'g');
- text = text.replace(a, '\\' + e);
- }
-
- var chars = ['\\', '[', '^', '$', '.', '|', '?', '*', '+', '(', ')'];
- for (var e = 0; e < chars.length; e++) {
- escape(chars[e]);
- }
- return text;
- };
-
- Str.matchCase = function (text, mc) {
- if (!mc) {
- return this.lower(text);
- }
- return text;
- };
-
- exports.Str = Str;
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) {
-
- /**
- * Cookie utilities
- */
-
- 'use strict';
-
- var Cookie = {};
-
- Cookie.write = function (name, value, hours) {
- var expire = '';
- if (hours) {
- expire = new Date(new Date().getTime() + hours * 3600000);
- expire = '; expires=' + expire.toGMTString();
- }
- document.cookie = name + '=' + escape(value) + expire;
- };
-
- Cookie.read = function (name) {
- var cookieValue = '',
- search = name + '=';
- if (document.cookie.length > 0) {
- var cookie = document.cookie,
- offset = cookie.indexOf(search);
- if (offset !== -1) {
- offset += search.length;
- var end = cookie.indexOf(';', offset);
- if (end === -1) {
- end = cookie.length;
- }
- cookieValue = unescape(cookie.substring(offset, end));
- }
- }
- return cookieValue;
- };
-
- Cookie.remove = function (name) {
- this.write(name, '', -1);
- };
-
- Cookie.valueToArray = function (name, separator) {
- if (!separator) {
- separator = ',';
- }
- //reads the cookie
- var val = this.read(name);
- //creates an array with filters' values
- var arr = val.split(separator);
- return arr;
- };
-
- Cookie.getValueByIndex = function (name, index, separator) {
- if (!separator) {
- separator = ',';
- }
- //reads the cookie
- var val = this.valueToArray(name, separator);
- return val[index];
- };
-
- exports.Cookie = Cookie;
-
-/***/ },
-/* 6 */
-/***/ function(module, exports, __webpack_require__) {
-
- /**
- * Types utilities
- */
-
- 'use strict';
-
- var Types = {};
-
- var UNDEFINED = void 0;
-
- /**
- * Checks if var exists and is an object
- * @param {String or Object} v
- * @return {Boolean}
- */
- Types.isObj = function (v) {
- var isO = false;
- if (typeof v === 'string') {
- if (window[v] && typeof window[v] === 'object') {
- isO = true;
- }
- } else {
- if (v && typeof v === 'object') {
- isO = true;
- }
- }
- return isO;
- };
-
- /**
- * Checks if passed parameter is a function
- * @param {Function} fn
- * @return {Boolean}
- */
- Types.isFn = function (fn) {
- return fn && fn.constructor == Function;
- };
-
- /**
- * Checks if passed param is an array
- * @param {Array} obj
- * @return {Boolean}
- */
- Types.isArray = function (obj) {
- return obj && obj.constructor == Array;
- };
-
- /**
- * Determines if passed param is undefined
- * @param {Any} o
- * @return {Boolean}
- */
- Types.isUndef = function (o) {
- return o === UNDEFINED;
- };
-
- exports.Types = Types;
-
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) {
-
- /**
- * Array utilities
- */
-
- 'use strict';
-
- var _Str = __webpack_require__(4);
-
- var Arr = {
- has: function has(arr, val, caseSensitive) {
- var sCase = caseSensitive === undefined ? false : caseSensitive;
- for (var i = 0; i < arr.length; i++) {
- if (_Str.Str.matchCase(arr[i].toString(), sCase) == val) {
- return true;
- }
- }
- return false;
- },
- indexByValue: function indexByValue(arr, val, caseSensitive) {
- var sCase = caseSensitive === undefined ? false : caseSensitive;
- for (var i = 0; i < arr.length; i++) {
- if (_Str.Str.matchCase(arr[i].toString(), sCase) == val) {
- return i;
- }
- }
- return -1;
- }
- };
-
- exports.Arr = Arr;
-
-/***/ },
-/* 8 */
-/***/ function(module, exports, __webpack_require__) {
-
- /**
- * Misc helpers
- */
-
- 'use strict';
-
- var _Str = __webpack_require__(4);
-
- var Helpers = {
- isIE: function isIE() {
- return /msie|MSIE/.test(navigator.userAgent);
- },
-
- removeNbFormat: function removeNbFormat(data, format) {
- if (!data) {
- return;
- }
- if (!format) {
- format = 'us';
- }
- var n = data;
- if (_Str.Str.lower(format) === 'us') {
- n = +n.replace(/[^\d\.-]/g, '');
- } else {
- n = +n.replace(/[^\d\,-]/g, '').replace(',', '.');
- }
- return n;
- }
- };
-
- exports.Helpers = Helpers;
-
-/***/ },
-/* 9 */
-/***/ function(module, exports, __webpack_require__) {
-
- /**
- * Date utilities
- */
-
- 'use strict';
-
- var DateHelper = {
- isValid: function isValid(dateStr, format) {
- if (!format) {
- format = 'DMY';
- }
- format = format.toUpperCase();
- if (format.length != 3) {
- if (format === 'DDMMMYYYY') {
- var d = this.format(dateStr, format);
- dateStr = d.getDate() + '/' + (d.getMonth() + 1) + '/' + d.getFullYear();
- format = 'DMY';
- }
- }
- if (format.indexOf('M') === -1 || format.indexOf('D') === -1 || format.indexOf('Y') === -1) {
- format = 'DMY';
- }
- var reg1, reg2;
- // If the year is first
- if (format.substring(0, 1) == 'Y') {
- reg1 = /^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/;
- reg2 = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/;
- } else if (format.substring(1, 2) == 'Y') {
- // If the year is second
- reg1 = /^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/;
- reg2 = /^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/;
- } else {
- // The year must be third
- reg1 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/;
- reg2 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/;
- }
- // If it doesn't conform to the right format (with either a 2 digit year or
- // 4 digit year), fail
- if (reg1.test(dateStr) === false && reg2.test(dateStr) === false) {
- return false;
- }
- // Split into 3 parts based on what the divider was
- var parts = dateStr.split(RegExp.$1);
- var mm, dd, yy;
- // Check to see if the 3 parts end up making a valid date
- if (format.substring(0, 1) === 'M') {
- mm = parts[0];
- } else if (format.substring(1, 2) === 'M') {
- mm = parts[1];
- } else {
- mm = parts[2];
- }
- if (format.substring(0, 1) === 'D') {
- dd = parts[0];
- } else if (format.substring(1, 2) === 'D') {
- dd = parts[1];
- } else {
- dd = parts[2];
- }
- if (format.substring(0, 1) === 'Y') {
- yy = parts[0];
- } else if (format.substring(1, 2) === 'Y') {
- yy = parts[1];
- } else {
- yy = parts[2];
- }
- if (parseInt(yy, 10) <= 50) {
- yy = (parseInt(yy, 10) + 2000).toString();
- }
- if (parseInt(yy, 10) <= 99) {
- yy = (parseInt(yy, 10) + 1900).toString();
- }
- var dt = new Date(parseInt(yy, 10), parseInt(mm, 10) - 1, parseInt(dd, 10), 0, 0, 0, 0);
- if (parseInt(dd, 10) != dt.getDate()) {
- return false;
- }
- if (parseInt(mm, 10) - 1 != dt.getMonth()) {
- return false;
- }
- return true;
- },
- format: (function (_format) {
- function format(_x, _x2) {
- return _format.apply(this, arguments);
- }
-
- format.toString = function () {
- return _format.toString();
- };
-
- return format;
- })(function (dateStr, format) {
- if (!format) {
- format = 'DMY';
- }
- if (!dateStr || dateStr === '') {
- return new Date(1001, 0, 1);
- }
- var oDate, parts;
-
- function y2kDate(yr) {
- if (yr === undefined) {
- return 0;
- }
- if (yr.length > 2) {
- return yr;
- }
- var y;
- //>50 belong to 1900
- if (yr <= 99 && yr > 50) {
- y = '19' + yr;
- }
- //<50 belong to 2000
- if (yr < 50 || yr === '00') {
- y = '20' + yr;
- }
- return y;
- }
-
- function mmm2mm(mmm) {
- if (mmm === undefined) {
- return 0;
- }
- var mondigit;
- var MONTH_NAMES = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december', 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
- for (var m_i = 0; m_i < MONTH_NAMES.length; m_i++) {
- var month_name = MONTH_NAMES[m_i];
- if (mmm.toLowerCase() === month_name) {
- mondigit = m_i + 1;
- break;
- }
- }
- if (mondigit > 11 || mondigit < 23) {
- mondigit = mondigit - 12;
- }
- if (mondigit < 1 || mondigit > 12) {
- return 0;
- }
- return mondigit;
- }
-
- switch (format.toUpperCase()) {
- case 'DDMMMYYYY':
- parts = dateStr.replace(/[- \/.]/g, ' ').split(' ');
- oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]);
- break;
- case 'DMY':
- parts = dateStr.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, '$1 $3 $5').split(' ');
- oDate = new Date(y2kDate(parts[2]), parts[1] - 1, parts[0]);
- break;
- case 'MDY':
- parts = dateStr.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/, '$1 $3 $5').split(' ');
- oDate = new Date(y2kDate(parts[2]), parts[0] - 1, parts[1]);
- break;
- case 'YMD':
- parts = dateStr.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/, '$1 $4 $6').split(' ');
- oDate = new Date(y2kDate(parts[0]), parts[1] - 1, parts[2]);
- break;
- default:
- //in case format is not correct
- parts = dateStr.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, '$1 $3 $5').split(' ');
- oDate = new Date(y2kDate(parts[2]), parts[1] - 1, parts[0]);
- break;
- }
- return oDate;
- })
- };
-
- exports.DateHelper = DateHelper;
-
-/***/ },
-/* 10 */
-/***/ function(module, exports, __webpack_require__) {
-
- /**
- * Sort helpers
- */
-
- 'use strict';
-
- var _Str = __webpack_require__(4);
-
- var Sort = {
- ignoreCase: function ignoreCase(a, b) {
- var x = _Str.Str.lower(a);
- var y = _Str.Str.lower(b);
- return x < y ? -1 : x > y ? 1 : 0;
- }
- };
-
- exports.Sort = Sort;
-
-/***/ },
-/* 11 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Cookie = __webpack_require__(5);
-
- var Store = (function () {
-
- /**
- * Store, persistence manager
- * @param {Object} tf TableFilter instance
- */
-
- function Store(tf) {
- _classCallCheck(this, Store);
-
- var f = tf.config();
-
- this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000;
-
- this.tf = tf;
- }
-
- _createClass(Store, [{
- key: 'saveFilterValues',
-
- /**
- * Store filters' values in cookie
- * @param {String} cookie name
- */
- value: function saveFilterValues(name) {
- var tf = this.tf;
- var fltValues = [];
- //store filters' values
- for (var i = 0; i < tf.fltIds.length; i++) {
- var value = tf.getFilterValue(i);
- if (value === '') {
- value = ' ';
- }
- fltValues.push(value);
- }
- //adds array size
- fltValues.push(tf.fltIds.length);
-
- //writes cookie
- _Cookie.Cookie.write(name, fltValues.join(tf.separator), this.duration);
- }
- }, {
- key: 'getFilterValues',
-
- /**
- * Retrieve filters' values from cookie
- * @param {String} cookie name
- * @return {Array}
- */
- value: function getFilterValues(name) {
- var flts = _Cookie.Cookie.read(name);
- var rgx = new RegExp(this.tf.separator, 'g');
- // filters' values array
- return flts.split(rgx);
- }
- }, {
- key: 'savePageNb',
-
- /**
- * Store page number in cookie
- * @param {String} cookie name
- */
- value: function savePageNb(name) {
- _Cookie.Cookie.write(name, this.tf.Cpt.paging.currentPageNb, this.duration);
- }
- }, {
- key: 'getPageNb',
-
- /**
- * Retrieve page number from cookie
- * @param {String} cookie name
- * @return {String}
- */
- value: function getPageNb(name) {
- return _Cookie.Cookie.read(name);
- }
- }, {
- key: 'savePageLength',
-
- /**
- * Store page length in cookie
- * @param {String} cookie name
- */
- value: function savePageLength(name) {
- _Cookie.Cookie.write(name, this.tf.Cpt.paging.resultsPerPageSlc.selectedIndex, this.duration);
- }
- }, {
- key: 'getPageLength',
-
- /**
- * Retrieve page length from cookie
- * @param {String} cookie name
- * @return {String}
- */
- value: function getPageLength(name) {
- return _Cookie.Cookie.read(name);
- }
- }]);
-
- return Store;
- })();
-
- exports.Store = Store;
-
-/***/ },
-/* 12 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _Types = __webpack_require__(6);
-
- var _Helpers = __webpack_require__(8);
-
- var _Event = __webpack_require__(2);
-
- var GridLayout = (function () {
-
- /**
- * Grid layout, table with fixed headers
- * @param {Object} tf TableFilter instance
- */
-
- function GridLayout(tf) {
- _classCallCheck(this, GridLayout);
-
- var f = tf.config();
-
- //defines grid width
- this.gridWidth = f.grid_width || null;
- //defines grid height
- this.gridHeight = f.grid_height || null;
- //defines css class for main container
- this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont';
- //defines css class for div containing table
- this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont';
- //defines css class for div containing headers' table
- this.gridHeadContCssClass = f.grid_tblHead_cont_css_class || 'grd_headTblCont';
- //defines css class for div containing rows counter, paging etc.
- this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf';
- //defines which row contains column headers
- this.gridHeadRowIndex = f.grid_headers_row_index || 0;
- //array of headers row indexes to be placed in header table
- this.gridHeadRows = f.grid_headers_rows || [0];
- //generate filters in table headers
- this.gridEnableFilters = f.grid_enable_default_filters !== undefined ? f.grid_enable_default_filters : true;
- //default col width
- this.gridDefaultColWidth = f.grid_default_col_width || '100px';
- //enables/disables columns resizer
- this.gridEnableColResizer = f.grid_enable_cols_resizer !== undefined ? f.grid_enable_cols_resizer : false;
- //defines col resizer script path
- this.gridColResizerPath = f.grid_cont_col_resizer_path || this.basePath + 'TFExt_ColsResizer/TFExt_ColsResizer.js';
-
- this.gridColElms = [];
-
- //div containing grid elements if grid_layout true
- this.prfxMainTblCont = 'gridCont_';
- //div containing table if grid_layout true
- this.prfxTblCont = 'tblCont_';
- //div containing headers table if grid_layout true
- this.prfxHeadTblCont = 'tblHeadCont_';
- //headers' table if grid_layout true
- this.prfxHeadTbl = 'tblHead_';
- //id of td containing the filter if grid_layout true
- this.prfxGridFltTd = '_td_';
- //id of th containing column header if grid_layout true
- this.prfxGridTh = 'tblHeadTh_';
-
- this.tf = tf;
- }
-
- _createClass(GridLayout, [{
- key: 'init',
-
- /**
- * Generates a grid with fixed headers
- */
- value: function init() {
- var _this = this;
-
- var tf = this.tf;
- var f = tf.config();
- var tbl = tf.tbl;
-
- if (!tf.gridLayout) {
- return;
- }
-
- tf.isExternalFlt = true;
-
- // default width of 100px if column widths not set
- if (!tf.hasColWidth) {
- tf.colWidth = [];
- for (var k = 0; k < tf.nbCells; k++) {
- var colW,
- cell = tbl.rows[this.gridHeadRowIndex].cells[k];
- if (cell.width !== '') {
- colW = cell.width;
- } else if (cell.style.width !== '') {
- colW = parseInt(cell.style.width, 10);
- } else {
- colW = this.gridDefaultColWidth;
- }
- tf.colWidth[k] = colW;
- }
- tf.hasColWidth = true;
- }
- tf.setColWidths(this.gridHeadRowIndex);
-
- var tblW; //initial table width
- if (tbl.width !== '') {
- tblW = tbl.width;
- } else if (tbl.style.width !== '') {
- tblW = parseInt(tbl.style.width, 10);
- } else {
- tblW = tbl.clientWidth;
- }
-
- //Main container: it will contain all the elements
- this.tblMainCont = _Dom.Dom.create('div', ['id', this.prfxMainTblCont + tf.id]);
- this.tblMainCont.className = this.gridMainContCssClass;
- if (this.gridWidth) {
- this.tblMainCont.style.width = this.gridWidth;
- }
- tbl.parentNode.insertBefore(this.tblMainCont, tbl);
-
- //Table container: div wrapping content table
- this.tblCont = _Dom.Dom.create('div', ['id', this.prfxTblCont + tf.id]);
- this.tblCont.className = this.gridContCssClass;
- if (this.gridWidth) {
- this.tblCont.style.width = this.gridWidth;
- }
- if (this.gridHeight) {
- this.tblCont.style.height = this.gridHeight;
- }
- tbl.parentNode.insertBefore(this.tblCont, tbl);
- var t = tbl.parentNode.removeChild(tbl);
- this.tblCont.appendChild(t);
-
- //In case table width is expressed in %
- if (tbl.style.width === '') {
- tbl.style.width = (tf._containsStr('%', tblW) ? tbl.clientWidth : tblW) + 'px';
- }
-
- var d = this.tblCont.parentNode.removeChild(this.tblCont);
- this.tblMainCont.appendChild(d);
-
- //Headers table container: div wrapping headers table
- this.headTblCont = _Dom.Dom.create('div', ['id', this.prfxHeadTblCont + tf.id]);
- this.headTblCont.className = this.gridHeadContCssClass;
- if (this.gridWidth) {
- this.headTblCont.style.width = this.gridWidth;
- }
-
- //Headers table
- this.headTbl = _Dom.Dom.create('table', ['id', this.prfxHeadTbl + tf.id]);
- var tH = _Dom.Dom.create('tHead'); //IE<7 needs it
-
- //1st row should be headers row, ids are added if not set
- //Those ids are used by the sort feature
- var hRow = tbl.rows[this.gridHeadRowIndex];
- var sortTriggers = [];
- for (var n = 0; n < tf.nbCells; n++) {
- var c = hRow.cells[n];
- var thId = c.getAttribute('id');
- if (!thId || thId === '') {
- thId = this.prfxGridTh + n + '_' + tf.id;
- c.setAttribute('id', thId);
- }
- sortTriggers.push(thId);
- }
-
- //Filters row is created
- var filtersRow = _Dom.Dom.create('tr');
- if (this.gridEnableFilters && tf.fltGrid) {
- tf.externalFltTgtIds = [];
- for (var j = 0; j < tf.nbCells; j++) {
- var fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id;
- var cl = _Dom.Dom.create(tf.fltCellTag, ['id', fltTdId]);
- filtersRow.appendChild(cl);
- tf.externalFltTgtIds[j] = fltTdId;
- }
- }
- //Headers row are moved from content table to headers table
- for (var i = 0; i < this.gridHeadRows.length; i++) {
- var headRow = tbl.rows[this.gridHeadRows[0]];
- tH.appendChild(headRow);
- }
- this.headTbl.appendChild(tH);
- if (tf.filtersRowIndex === 0) {
- tH.insertBefore(filtersRow, hRow);
- } else {
- tH.appendChild(filtersRow);
- }
-
- this.headTblCont.appendChild(this.headTbl);
- this.tblCont.parentNode.insertBefore(this.headTblCont, this.tblCont);
-
- //THead needs to be removed in content table for sort feature
- var thead = _Dom.Dom.tag(tbl, 'thead');
- if (thead.length > 0) {
- tbl.removeChild(thead[0]);
- }
-
- //Headers table style
- this.headTbl.style.tableLayout = 'fixed';
- tbl.style.tableLayout = 'fixed';
- this.headTbl.cellPadding = tbl.cellPadding;
- this.headTbl.cellSpacing = tbl.cellSpacing;
- // this.headTbl.style.width = tbl.style.width;
-
- //content table without headers needs col widths to be reset
- tf.setColWidths();
-
- //Headers container width
- this.headTblCont.style.width = this.tblCont.clientWidth + 'px';
-
- tbl.style.width = '';
- //
- this.headTbl.style.width = tbl.clientWidth + 'px';
- //
-
- //scroll synchronisation
- _Event.Event.add(this.tblCont, 'scroll', function (evt) {
- var elm = _Event.Event.target(evt);
- var scrollLeft = elm.scrollLeft;
- _this.headTblCont.scrollLeft = scrollLeft;
- //New pointerX calc taking into account scrollLeft
- // if(!o.isPointerXOverwritten){
- // try{
- // o.Evt.pointerX = function(evt){
- // var e = evt || global.event;
- // var bdScrollLeft = tf_StandardBody().scrollLeft +
- // scrollLeft;
- // return (e.pageX + scrollLeft) ||
- // (e.clientX + bdScrollLeft);
- // };
- // o.isPointerXOverwritten = true;
- // } catch(err) {
- // o.isPointerXOverwritten = false;
- // }
- // }
- });
-
- //Sort is enabled if not specified in config object
- if (f.sort !== false) {
- tf.sort = true;
- tf.sortConfig.asyncSort = true;
- tf.sortConfig.triggerIds = sortTriggers;
- }
-
- if (this.gridEnableColResizer) {
- if (!tf.hasExtensions) {
- tf.extensions = {
- name: ['ColumnsResizer_' + tf.id],
- src: [this.gridColResizerPath],
- description: ['Columns Resizing'],
- initialize: [function (o) {
- o.SetColsResizer('ColumnsResizer_' + o.id);
- }]
- };
- tf.hasExtensions = true;
- } else {
- if (!tf._containsStr('colsresizer', Str.lower(tf.extensions.src.toString()))) {
- tf.extensions.name.push('ColumnsResizer_' + tf.id);
- tf.extensions.src.push(tf.gridColResizerPath);
- tf.extensions.description.push('Columns Resizing');
- tf.extensions.initialize.push(function (o) {
- o.SetColsResizer('ColumnsResizer_' + o.id);
- });
- }
- }
- }
-
- //Default columns resizer properties for grid layout
- f.col_resizer_cols_headers_table = this.headTbl.getAttribute('id');
- f.col_resizer_cols_headers_index = this.gridHeadRowIndex;
- f.col_resizer_width_adjustment = 0;
- f.col_enable_text_ellipsis = false;
-
- //Cols generation for all browsers excepted IE<=7
- this.tblHasColTag = _Dom.Dom.tag(tbl, 'col').length > 0 ? true : false;
-
- //Col elements are enough to keep column widths after sorting and
- //filtering
- var createColTags = function createColTags(o) {
- if (!o) {
- return;
- }
- for (var k = tf.nbCells - 1; k >= 0; k--) {
- var col = _Dom.Dom.create('col', ['id', tf.id + '_col_' + k]);
- tbl.firstChild.parentNode.insertBefore(col, tbl.firstChild);
- col.style.width = tf.colWidth[k];
- o.gridColElms[k] = col;
- }
- o.tblHasColTag = true;
- };
- if (!this.tblHasColTag) {
- createColTags(this);
- } else {
- var cols = _Dom.Dom.tag(tbl, 'col');
- for (var ii = 0; ii < tf.nbCells; ii++) {
- cols[ii].setAttribute('id', tf.id + '_col_' + ii);
- cols[ii].style.width = tf.colWidth[ii];
- o.gridColElms.push(cols[ii]);
- }
- }
-
- var afterColResizedFn = _Types.Types.isFn(f.on_after_col_resized) ? f.on_after_col_resized : null;
- f.on_after_col_resized = function (o, colIndex) {
- if (!colIndex) {
- return;
- }
- var w = o.crWColsRow.cells[colIndex].style.width;
- var col = o.gridColElms[colIndex];
- col.style.width = w;
-
- var thCW = o.crWColsRow.cells[colIndex].clientWidth;
- var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth;
-
- if (thCW != tdCW /*&& !Helpers.isIE()*/) {
- o.headTbl.style.width = tbl.clientWidth + 'px';
- }
-
- if (afterColResizedFn) {
- afterColResizedFn.call(null, o, colIndex);
- }
- };
-
- if (tbl.clientWidth !== this.headTbl.clientWidth) {
- tbl.style.width = this.headTbl.clientWidth + 'px';
- }
-
- // Re-adjust reference row
- //tf.refRow = Helpers.isIE() ? (tf.refRow+1) : 0;
- }
- }, {
- key: 'destroy',
-
- /**
- * Removes the grid layout
- */
- value: function destroy() {
- var tf = this.tf;
- var tbl = tf.tbl;
-
- if (!tf.gridLayout) {
- return;
- }
- var t = tbl.parentNode.removeChild(tbl);
- this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont);
- this.tblMainCont.parentNode.removeChild(this.tblMainCont);
-
- this.tblMainCont = null;
- this.headTblCont = null;
- this.headTbl = null;
- this.tblCont = null;
-
- tbl.outerHTML = tf.sourceTblHtml;
- //needed to keep reference of table element
- tbl = _Dom.Dom.id(tf.id);
- }
- }]);
-
- return GridLayout;
- })();
-
- exports.GridLayout = GridLayout;
-
-/***/ },
-/* 13 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _Types = __webpack_require__(6);
-
- var global = window;
-
- /**
- * Loading message/spinner
- * @param {Object} tf TableFilter instance
- */
-
- var Loader = (function () {
- function Loader(tf) {
- _classCallCheck(this, Loader);
-
- // TableFilter configuration
- var f = tf.config();
- //id of container element
- this.loaderTgtId = f.loader_target_id || null;
- //div containing loader
- this.loaderDiv = null;
- //defines loader text
- this.loaderText = f.loader_text || 'Loading...';
- //defines loader innerHtml
- this.loaderHtml = f.loader_html || null;
- //defines css class for loader div
- this.loaderCssClass = f.loader_css_class || 'loader';
- //delay for hiding loader
- this.loaderCloseDelay = 200;
- //callback function before loader is displayed
- this.onShowLoader = _Types.Types.isFn(f.on_show_loader) ? f.on_show_loader : null;
- //callback function after loader is closed
- this.onHideLoader = _Types.Types.isFn(f.on_hide_loader) ? f.on_hide_loader : null;
- //loader div
- this.prfxLoader = 'load_';
-
- this.tf = tf;
-
- var containerDiv = _Dom.Dom.create('div', ['id', this.prfxLoader + tf.id]);
- containerDiv.className = this.loaderCssClass;
-
- var targetEl = !this.loaderTgtId ? tf.tbl.parentNode : _Dom.Dom.id(this.loaderTgtId);
- if (!this.loaderTgtId) {
- targetEl.insertBefore(containerDiv, tf.tbl);
- } else {
- targetEl.appendChild(containerDiv);
- }
- this.loaderDiv = _Dom.Dom.id(this.prfxLoader + tf.id);
- if (!this.loaderHtml) {
- this.loaderDiv.appendChild(_Dom.Dom.text(this.loaderText));
- } else {
- this.loaderDiv.innerHTML = this.loaderHtml;
- }
- }
-
- _createClass(Loader, [{
- key: 'show',
- value: function show(p) {
- var _this = this;
-
- if (!this.tf.loader || !this.loaderDiv || this.loaderDiv.style.display === p) {
- return;
- }
-
- var displayLoader = function displayLoader() {
- if (!_this.loaderDiv) {
- return;
- }
- if (_this.onShowLoader && p !== 'none') {
- _this.onShowLoader.call(null, _this);
- }
- _this.loaderDiv.style.display = p;
- if (_this.onHideLoader && p === 'none') {
- _this.onHideLoader.call(null, _this);
- }
- };
-
- var t = p === 'none' ? this.loaderCloseDelay : 1;
- global.setTimeout(displayLoader, t);
- }
- }, {
- key: 'remove',
- value: function remove() {
- if (!this.loaderDiv) {
- return;
- }
- var tf = this.tf,
- targetEl = !this.loaderTgtId ? tf.gridLayout ? tf.Cpt.gridLayout.tblCont : tf.tbl.parentNode : _Dom.Dom.id(this.loaderTgtId);
- targetEl.removeChild(this.loaderDiv);
- this.loaderDiv = null;
- }
- }]);
-
- return Loader;
- })();
-
- exports.Loader = Loader;
-
-/***/ },
-/* 14 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _Str = __webpack_require__(4);
-
- var HighlightKeyword = (function () {
-
- /**
- * HighlightKeyword, highlight matched keyword
- * @param {Object} tf TableFilter instance
- */
-
- function HighlightKeyword(tf) {
- _classCallCheck(this, HighlightKeyword);
-
- var f = tf.config();
- //defines css class for highlighting
- this.highlightCssClass = f.highlight_css_class || 'keyword';
- this.highlightedNodes = [];
-
- this.tf = tf;
- }
-
- _createClass(HighlightKeyword, [{
- key: 'highlight',
-
- /**
- * highlight occurences of searched term in passed node
- * @param {Node} node
- * @param {String} word Searched term
- * @param {String} cssClass Css class name
- */
- value: function highlight(node, word, cssClass) {
- // Iterate into this nodes childNodes
- if (node.hasChildNodes) {
- var children = node.childNodes;
- for (var i = 0; i < children.length; i++) {
- this.highlight(children[i], word, cssClass);
- }
- }
-
- if (node.nodeType === 3) {
- var tempNodeVal = _Str.Str.lower(node.nodeValue);
- var tempWordVal = _Str.Str.lower(word);
- if (tempNodeVal.indexOf(tempWordVal) != -1) {
- var pn = node.parentNode;
- if (pn && pn.className != cssClass) {
- // word not highlighted yet
- var nv = node.nodeValue,
- ni = tempNodeVal.indexOf(tempWordVal),
-
- // Create a load of replacement nodes
- before = _Dom.Dom.text(nv.substr(0, ni)),
- docWordVal = nv.substr(ni, word.length),
- after = _Dom.Dom.text(nv.substr(ni + word.length)),
- hiwordtext = _Dom.Dom.text(docWordVal),
- hiword = _Dom.Dom.create('span');
- hiword.className = cssClass;
- hiword.appendChild(hiwordtext);
- pn.insertBefore(before, node);
- pn.insertBefore(hiword, node);
- pn.insertBefore(after, node);
- pn.removeChild(node);
- this.highlightedNodes.push(hiword.firstChild);
- }
- }
- }
- }
- }, {
- key: 'unhighlight',
-
- /**
- * Removes highlight to nodes matching passed string
- * @param {String} word
- * @param {String} cssClass Css class to remove
- */
- value: function unhighlight(word, cssClass) {
- var arrRemove = [];
- var highlightedNodes = this.highlightedNodes;
- for (var i = 0; i < highlightedNodes.length; i++) {
- var n = highlightedNodes[i];
- if (!n) {
- continue;
- }
- var tempNodeVal = _Str.Str.lower(n.nodeValue),
- tempWordVal = _Str.Str.lower(word);
- if (tempNodeVal.indexOf(tempWordVal) !== -1) {
- var pn = n.parentNode;
- if (pn && pn.className === cssClass) {
- var prevSib = pn.previousSibling,
- nextSib = pn.nextSibling;
- if (!prevSib || !nextSib) {
- continue;
- }
- nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue;
- prevSib.nodeValue = '';
- n.nodeValue = '';
- arrRemove.push(i);
- }
- }
- }
- for (var k = 0; k < arrRemove.length; k++) {
- highlightedNodes.splice(arrRemove[k], 1);
- }
- }
- }, {
- key: 'unhighlightAll',
-
- /**
- * Clear all occurrences of highlighted nodes
- */
- value: function unhighlightAll() {
- if (!this.tf.highlightKeywords || !this.tf.searchArgs) {
- return;
- }
- for (var y = 0; y < this.tf.searchArgs.length; y++) {
- this.unhighlight(this.tf.searchArgs[y], this.highlightCssClass);
- }
- this.highlightedNodes = [];
- }
- }]);
-
- return HighlightKeyword;
- })();
-
- exports.HighlightKeyword = HighlightKeyword;
-
-/***/ },
-/* 15 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(global) {'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Types = __webpack_require__(6);
-
- var _Dom = __webpack_require__(3);
-
- var _Event = __webpack_require__(2);
-
- var _Helpers = __webpack_require__(8);
-
- var PopupFilter = (function () {
-
- /**
- * Pop-up filter component
- * @param {Object} tf TableFilter instance
- */
-
- function PopupFilter(tf) {
- _classCallCheck(this, PopupFilter);
-
- // Configuration object
- var f = tf.config();
-
- // Enable external filters behaviour
- tf.isExternalFlt = true;
- tf.externalFltTgtIds = [];
-
- //filter icon path
- this.popUpImgFlt = f.popup_filters_image || tf.themesPath + 'icn_filter.gif';
- //active filter icon path
- this.popUpImgFltActive = f.popup_filters_image_active || tf.themesPath + 'icn_filterActive.gif';
- this.popUpImgFltHtml = f.popup_filters_image_html || ' ';
- //defines css class for popup div containing filter
- this.popUpDivCssClass = f.popup_div_css_class || 'popUpFilter';
- //callback function before popup filtes is opened
- this.onBeforePopUpOpen = _Types.Types.isFn(f.on_before_popup_filter_open) ? f.on_before_popup_filter_open : null;
- //callback function after popup filtes is opened
- this.onAfterPopUpOpen = _Types.Types.isFn(f.on_after_popup_filter_open) ? f.on_after_popup_filter_open : null;
- //callback function before popup filtes is closed
- this.onBeforePopUpClose = _Types.Types.isFn(f.on_before_popup_filter_close) ? f.on_before_popup_filter_close : null;
- //callback function after popup filtes is closed
- this.onAfterPopUpClose = _Types.Types.isFn(f.on_after_popup_filter_close) ? f.on_after_popup_filter_close : null;
-
- //stores filters spans
- this.popUpFltSpans = [];
- //stores filters icons
- this.popUpFltImgs = [];
- //stores filters containers
- this.popUpFltElms = this.popUpFltElmCache || [];
- this.popUpFltAdjustToContainer = true;
-
- //id prefix for pop-up filter span
- this.prfxPopUpSpan = 'popUpSpan_';
- //id prefix for pop-up div containing filter
- this.prfxPopUpDiv = 'popUpDiv_';
-
- this.tf = tf;
- }
-
- _createClass(PopupFilter, [{
- key: 'onClick',
- value: function onClick(e) {
- var evt = e || global.event,
- elm = evt.target.parentNode,
- colIndex = parseInt(elm.getAttribute('ci'), 10);
-
- this.closeAll(colIndex);
- this.toggle(colIndex);
-
- if (this.popUpFltAdjustToContainer) {
- var popUpDiv = this.popUpFltElms[colIndex],
- header = this.tf.getHeaderElement(colIndex),
- headerWidth = header.clientWidth * 0.95;
- if (_Helpers.Helpers.isIE()) {
- var headerLeft = _Dom.Dom.position(header).left;
- popUpDiv.style.left = headerLeft + 'px';
- }
- popUpDiv.style.width = parseInt(headerWidth, 10) + 'px';
- }
- _Event.Event.cancel(evt);
- _Event.Event.stop(evt);
- }
- }, {
- key: 'init',
-
- /**
- * Initialize DOM elements
- */
- value: function init() {
- var _this = this;
-
- var tf = this.tf;
- for (var i = 0; i < tf.nbCells; i++) {
- if (tf['col' + i] === tf.fltTypeNone) {
- continue;
- }
- var popUpSpan = _Dom.Dom.create('span', ['id', this.prfxPopUpSpan + tf.id + '_' + i], ['ci', i]);
- popUpSpan.innerHTML = this.popUpImgFltHtml;
- var header = tf.getHeaderElement(i);
- header.appendChild(popUpSpan);
- _Event.Event.add(popUpSpan, 'click', function (evt) {
- _this.onClick(evt);
- });
- this.popUpFltSpans[i] = popUpSpan;
- this.popUpFltImgs[i] = popUpSpan.firstChild;
- }
- }
- }, {
- key: 'buildAll',
-
- /**
- * Build all pop-up filters elements
- */
- value: function buildAll() {
- for (var i = 0; i < this.popUpFltElmCache.length; i++) {
- this.build(i, this.popUpFltElmCache[i]);
- }
- }
- }, {
- key: 'build',
-
- /**
- * Build a specified pop-up filter elements
- * @param {Number} colIndex Column index
- * @param {Object} div Optional container DOM element
- */
- value: function build(colIndex, div) {
- var tf = this.tf;
- var popUpDiv = !div ? _Dom.Dom.create('div', ['id', this.prfxPopUpDiv + tf.id + '_' + colIndex]) : div;
- popUpDiv.className = this.popUpDivCssClass;
- tf.externalFltTgtIds.push(popUpDiv.id);
- var header = tf.getHeaderElement(colIndex);
- header.insertBefore(popUpDiv, header.firstChild);
- _Event.Event.add(popUpDiv, 'click', function (evt) {
- _Event.Event.stop(evt);
- });
- this.popUpFltElms[colIndex] = popUpDiv;
- }
- }, {
- key: 'toggle',
-
- /**
- * Toogle visibility of specified filter
- * @param {Number} colIndex Column index
- */
- value: function toggle(colIndex) {
- var tf = this.tf,
- popUpFltElm = this.popUpFltElms[colIndex];
-
- if (popUpFltElm.style.display === 'none' || popUpFltElm.style.display === '') {
- if (this.onBeforePopUpOpen) {
- this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex);
- }
- popUpFltElm.style.display = 'block';
- if (tf['col' + colIndex] === tf.fltTypeInp) {
- var flt = tf.getFilterElement(colIndex);
- if (flt) {
- flt.focus();
- }
- }
- if (this.onAfterPopUpOpen) {
- this.onAfterPopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex);
- }
- } else {
- if (this.onBeforePopUpClose) {
- this.onBeforePopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex);
- }
- popUpFltElm.style.display = 'none';
- if (this.onAfterPopUpClose) {
- this.onAfterPopUpClose.call(null, this, this.popUpFltElms[colIndex], colIndex);
- }
- }
- }
- }, {
- key: 'closeAll',
-
- /**
- * Close all filters excepted for the specified one if any
- * @param {Number} exceptIdx Column index of the filter to not close
- */
- value: function closeAll(exceptIdx) {
- for (var i = 0; i < this.popUpFltElms.length; i++) {
- if (i === exceptIdx) {
- continue;
- }
- var popUpFltElm = this.popUpFltElms[i];
- if (popUpFltElm) {
- popUpFltElm.style.display = 'none';
- }
- }
- }
- }, {
- key: 'buildIcons',
-
- /**
- * Build all the icons representing the pop-up filters
- */
- value: function buildIcons() {
- for (var i = 0; i < this.popUpFltImgs.length; i++) {
- this.buildIcon(i, false);
- }
- }
- }, {
- key: 'buildIcon',
-
- /**
- * Build specified icon
- * @param {Number} colIndex Column index
- * @param {Boolean} active Apply active state
- */
- value: function buildIcon(colIndex, active) {
- var activeImg = _Types.Types.isUndef(active) ? true : active;
- if (this.popUpFltImgs[colIndex]) {
- this.popUpFltImgs[colIndex].src = active ? this.popUpImgFltActive : this.popUpImgFlt;
- }
- }
- }, {
- key: 'destroy',
-
- /**
- * Remove pop-up filters
- */
- value: function destroy() {
- this.popUpFltElmCache = [];
- for (var i = 0; i < this.popUpFltElms.length; i++) {
- var popUpFltElm = this.popUpFltElms[i],
- popUpFltSpan = this.popUpFltSpans[i],
- popUpFltImg = this.popUpFltImgs[i];
- if (popUpFltElm) {
- popUpFltElm.parentNode.removeChild(popUpFltElm);
- this.popUpFltElmCache[i] = popUpFltElm;
- }
- popUpFltElm = null;
- if (popUpFltSpan) {
- popUpFltSpan.parentNode.removeChild(popUpFltSpan);
- }
- popUpFltSpan = null;
- if (popUpFltImg) {
- popUpFltImg.parentNode.removeChild(popUpFltImg);
- }
- popUpFltImg = null;
- }
- this.popUpFltElms = [];
- this.popUpFltSpans = [];
- this.popUpFltImgs = [];
- }
- }]);
-
- return PopupFilter;
- })();
-
- exports.PopupFilter = PopupFilter;
- /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
-
-/***/ },
-/* 16 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _array = __webpack_require__(7);
-
- var _Str = __webpack_require__(4);
-
- var _Sort = __webpack_require__(10);
-
- var Dropdown = (function () {
-
- /**
- * Dropdown UI component
- * @param {Object} tf TableFilter instance
- */
-
- function Dropdown(tf) {
- _classCallCheck(this, Dropdown);
-
- // Configuration object
- var f = tf.config();
-
- this.enableSlcResetFilter = f.enable_slc_reset_filter ? false : true;
- //defines empty option text
- this.nonEmptyText = f.non_empty_text || '(Non empty)';
- //sets select filling method: 'innerHTML' or 'createElement'
- this.slcFillingMethod = f.slc_filling_method || 'createElement';
- //IE only, tooltip text appearing on select before it is populated
- this.activateSlcTooltip = f.activate_slc_tooltip || 'Click to activate';
- //tooltip text appearing on multiple select
- this.multipleSlcTooltip = f.multiple_slc_tooltip || 'Use Ctrl key for multiple selections';
-
- this.isCustom = null;
- this.opts = null;
- this.optsTxt = null;
- this.slcInnerHtml = null;
-
- this.tf = tf;
- }
-
- _createClass(Dropdown, [{
- key: 'build',
-
- /**
- * Build drop-down filter UI asynchronously
- * @param {Number} colIndex Column index
- * @param {Boolean} isRefreshed Enable linked refresh behaviour
- * @param {Boolean} isExternal Render in external container
- * @param {String} extSlcId External container id
- */
- value: function build(colIndex, isRefreshed, isExternal, extSlcId) {
- var tf = this.tf;
- tf.EvtManager(tf.Evt.name.dropdown, {
- slcIndex: colIndex,
- slcRefreshed: isRefreshed,
- slcExternal: isExternal,
- slcId: extSlcId
- });
- }
- }, {
- key: '_build',
-
- /**
- * Build drop-down filter UI
- * @param {Number} colIndex Column index
- * @param {Boolean} isRefreshed Enable linked refresh behaviour
- * @param {Boolean} isExternal Render in external container
- * @param {String} extSlcId External container id
- */
- value: function _build(colIndex) {
- var isRefreshed = arguments[1] === undefined ? false : arguments[1];
- var isExternal = arguments[2] === undefined ? false : arguments[2];
- var extSlcId = arguments[3] === undefined ? null : arguments[3];
-
- var tf = this.tf;
- colIndex = parseInt(colIndex, 10);
-
- this.opts = [];
- this.optsTxt = [];
- this.slcInnerHtml = '';
-
- var slcId = tf.fltIds[colIndex];
- if (!_Dom.Dom.id(slcId) && !isExternal || !_Dom.Dom.id(extSlcId) && isExternal) {
- return;
- }
- var slc = !isExternal ? _Dom.Dom.id(slcId) : _Dom.Dom.id(extSlcId),
- rows = tf.tbl.rows,
- matchCase = tf.matchCase,
- fillMethod = _Str.Str.lower(this.slcFillingMethod);
-
- //custom select test
- this.isCustom = tf.hasCustomSlcOptions && _array.Arr.has(tf.customSlcOptions.cols, colIndex);
-
- //custom selects text
- var activeFlt;
- if (isRefreshed && tf.activeFilterId) {
- activeFlt = tf.activeFilterId.split('_')[0];
- activeFlt = activeFlt.split(tf.prfxFlt)[1];
- }
-
- /*** remember grid values ***/
- var fltsValues = [],
- fltArr = [];
- if (tf.rememberGridValues) {
- fltsValues = tf.Cpt.store.getFilterValues(tf.fltsValuesCookie);
- if (fltsValues && !_Str.Str.isEmpty(fltsValues.toString())) {
- if (this.isCustom) {
- fltArr.push(fltsValues[colIndex]);
- } else {
- fltArr = fltsValues[colIndex].split(' ' + tf.orOperator + ' ');
- }
- }
- }
-
- var excludedOpts = null,
- filteredDataCol = null;
- if (isRefreshed && tf.disableExcludedOptions) {
- excludedOpts = [];
- filteredDataCol = [];
- }
-
- for (var k = tf.refRow; k < tf.nbRows; k++) {
- // always visible rows don't need to appear on selects as always
- // valid
- if (tf.hasVisibleRows && _array.Arr.has(tf.visibleRows, k) && !tf.paging) {
- continue;
- }
-
- var cell = rows[k].cells,
- nchilds = cell.length;
-
- // checks if row has exact cell #
- if (nchilds !== tf.nbCells || this.isCustom) {
- continue;
- }
-
- // this loop retrieves cell data
- for (var j = 0; j < nchilds; j++) {
- if (colIndex === j && (!isRefreshed || isRefreshed && tf.disableExcludedOptions) || colIndex == j && isRefreshed && (rows[k].style.display === '' && !tf.paging || tf.paging && (!tf.validRowsIndex || tf.validRowsIndex && _array.Arr.has(tf.validRowsIndex, k)) && (activeFlt === undefined || activeFlt == colIndex || activeFlt != colIndex && _array.Arr.has(tf.validRowsIndex, k)))) {
- var cell_data = tf.getCellData(j, cell[j]),
-
- //Vary Peter's patch
- cell_string = _Str.Str.matchCase(cell_data, matchCase);
-
- // checks if celldata is already in array
- if (!_array.Arr.has(this.opts, cell_string, matchCase)) {
- this.opts.push(cell_data);
- }
-
- if (isRefreshed && tf.disableExcludedOptions) {
- var filteredCol = filteredDataCol[j];
- if (!filteredCol) {
- filteredCol = this.GetFilteredDataCol(j);
- }
- if (!_array.Arr.has(filteredCol, cell_string, matchCase) && !_array.Arr.has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) {
- excludedOpts.push(cell_data);
- }
- }
- } //if colIndex==j
- } //for j
- } //for k
-
- //Retrieves custom values
- if (this.isCustom) {
- var customValues = tf.__getCustomValues(colIndex);
- this.opts = customValues[0];
- this.optsTxt = customValues[1];
- }
-
- if (tf.sortSlc && !this.isCustom) {
- if (!matchCase) {
- this.opts.sort(_Sort.Sort.ignoreCase);
- if (excludedOpts) {
- excludedOpts.sort(_Sort.Sort.ignoreCase);
- }
- } else {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- }
- }
-
- //asc sort
- if (tf.sortNumAsc && _array.Arr.has(tf.sortNumAsc, colIndex)) {
- try {
- this.opts.sort(numSortAsc);
- if (excludedOpts) {
- excludedOpts.sort(numSortAsc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(numSortAsc);
- }
- } catch (e) {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- if (this.isCustom) {
- this.optsTxt.sort();
- }
- } //in case there are alphanumeric values
- }
- //desc sort
- if (tf.sortNumDesc && _array.Arr.has(tf.sortNumDesc, colIndex)) {
- try {
- this.opts.sort(numSortDesc);
- if (excludedOpts) {
- excludedOpts.sort(numSortDesc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(numSortDesc);
- }
- } catch (e) {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- if (this.isCustom) {
- this.optsTxt.sort();
- }
- } //in case there are alphanumeric values
- }
-
- //populates drop-down
- this.addOptions(colIndex, slc, isRefreshed, excludedOpts, fltsValues, fltArr);
- }
- }, {
- key: 'addOptions',
-
- /**
- * Add drop-down options
- * @param {Number} colIndex Column index
- * @param {Object} slc Select Dom element
- * @param {Boolean} isRefreshed Enable linked refresh behaviour
- * @param {Array} excludedOpts Array of excluded options
- * @param {Array} fltsValues Collection of persisted filter values
- * @param {Array} fltArr Collection of persisted filter values
- */
- value: function addOptions(colIndex, slc, isRefreshed, excludedOpts, fltsValues, fltArr) {
- var tf = this.tf,
- fillMethod = _Str.Str.lower(this.slcFillingMethod),
- slcValue = slc.value;
-
- slc.innerHTML = '';
- slc = this.addFirstOption(slc);
-
- for (var y = 0; y < this.opts.length; y++) {
- if (this.opts[y] === '') {
- continue;
- }
- var val = this.opts[y]; //option value
- var lbl = this.isCustom ? this.optsTxt[y] : val; //option text
- var isDisabled = false;
- if (isRefreshed && this.disableExcludedOptions && _array.Arr.has(excludedOpts, _Str.Str.matchCase(val, tf.matchCase), tf.matchCase)) {
- isDisabled = true;
- }
-
- if (fillMethod === 'innerhtml') {
- var slcAttr = '';
- if (tf.fillSlcOnDemand && slcValue === this.opts[y]) {
- slcAttr = 'selected="selected"';
- }
- this.slcInnerHtml += '' + lbl + ' ';
- } else {
- var opt;
- //fill select on demand
- if (tf.fillSlcOnDemand && slcValue === this.opts[y] && tf['col' + colIndex] === tf.fltTypeSlc) {
- opt = _Dom.Dom.createOpt(lbl, val, true);
- } else {
- if (tf['col' + colIndex] !== tf.fltTypeMulti) {
- opt = _Dom.Dom.createOpt(lbl, val, fltsValues[colIndex] !== ' ' && val === fltsValues[colIndex] ? true : false);
- } else {
- opt = _Dom.Dom.createOpt(lbl, val, _array.Arr.has(fltArr, _Str.Str.matchCase(this.opts[y], tf.matchCase), tf.matchCase) || fltArr.toString().indexOf(val) !== -1 ? true : false);
- }
- }
- if (isDisabled) {
- opt.disabled = true;
- }
- slc.appendChild(opt);
- }
- } // for y
-
- if (fillMethod === 'innerhtml') {
- slc.innerHTML += this.slcInnerHtml;
- }
- slc.setAttribute('filled', '1');
- }
- }, {
- key: 'addFirstOption',
-
- /**
- * Add drop-down header option
- * @param {Object} slc Select DOM element
- */
- value: function addFirstOption(slc) {
- var tf = this.tf,
- fillMethod = _Str.Str.lower(this.slcFillingMethod);
-
- if (fillMethod === 'innerhtml') {
- this.slcInnerHtml += '' + tf.displayAllText + ' ';
- } else {
- var opt0 = _Dom.Dom.createOpt(!this.enableSlcResetFilter ? '' : tf.displayAllText, '');
- if (!this.enableSlcResetFilter) {
- opt0.style.display = 'none';
- }
- slc.appendChild(opt0);
- if (tf.enableEmptyOption) {
- var opt1 = _Dom.Dom.createOpt(tf.emptyText, tf.emOperator);
- slc.appendChild(opt1);
- }
- if (tf.enableNonEmptyOption) {
- var opt2 = _Dom.Dom.createOpt(tf.nonEmptyText, tf.nmOperator);
- slc.appendChild(opt2);
- }
- }
- return slc;
- }
- }]);
-
- return Dropdown;
- })();
-
- exports.Dropdown = Dropdown;
-
-/***/ },
-/* 17 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _array = __webpack_require__(7);
-
- var _Str = __webpack_require__(4);
-
- var _Sort = __webpack_require__(10);
-
- var _Event = __webpack_require__(2);
-
- var CheckList = (function () {
-
- /**
- * Checklist UI component
- * @param {Object} tf TableFilter instance
- */
-
- function CheckList(tf) {
- _classCallCheck(this, CheckList);
-
- // Configuration object
- var f = tf.config();
-
- this.checkListDiv = []; //checklist container div
- //defines css class for div containing checklist filter
- this.checkListDivCssClass = f.div_checklist_css_class || 'div_checklist';
- //defines css class for checklist filters
- this.checkListCssClass = f.checklist_css_class || 'flt_checklist';
- //defines css class for checklist item (li)
- this.checkListItemCssClass = f.checklist_item_css_class || 'flt_checklist_item';
- //defines css class for selected checklist item (li)
- this.checkListSlcItemCssClass = f.checklist_selected_item_css_class || 'flt_checklist_slc_item';
- //Load on demand text
- this.activateCheckListTxt = f.activate_checklist_text || 'Click to load filter data';
- //defines css class for checklist filters
- this.checkListItemDisabledCssClass = f.checklist_item_disabled_css_class || 'flt_checklist_item_disabled';
- this.enableCheckListResetFilter = f.enable_checklist_reset_filter === false ? false : true;
- //checklist filter container div
- this.prfxCheckListDiv = 'chkdiv_';
-
- this.isCustom = null;
- this.opts = null;
- this.optsTxt = null;
-
- this.tf = tf;
- }
-
- _createClass(CheckList, [{
- key: 'onChange',
-
- // TODO: move event here
- value: function onChange(evt) {
- this.tf.Evt.onSlcChange(evt);
- }
- }, {
- key: 'optionClick',
- value: function optionClick(evt) {
- this.setCheckListValues(evt.target);
- this.onChange(evt);
- }
- }, {
- key: 'build',
-
- /**
- * Build checklist UI asynchronously
- * @param {Number} colIndex Column index
- * @param {Boolean} isExternal Render in external container
- * @param {String} extFltId External container id
- */
- value: function build(colIndex, isExternal, extFltId) {
- var tf = this.tf;
- tf.EvtManager(tf.Evt.name.checklist, { slcIndex: colIndex, slcExternal: isExternal, slcId: extFltId });
- }
- }, {
- key: '_build',
-
- /**
- * Build checklist UI
- * @param {Number} colIndex Column index
- * @param {Boolean} isExternal Render in external container
- * @param {String} extFltId External container id
- */
- value: function _build(colIndex) {
- var _this = this;
-
- var isExternal = arguments[1] === undefined ? false : arguments[1];
- var extFltId = arguments[2] === undefined ? null : arguments[2];
-
- var tf = this.tf;
- colIndex = parseInt(colIndex, 10);
-
- this.opts = [];
- this.optsTxt = [];
-
- var divFltId = this.prfxCheckListDiv + colIndex + '_' + tf.id;
- if (!_Dom.Dom.id(divFltId) && !isExternal || !_Dom.Dom.id(extFltId) && isExternal) {
- return;
- }
-
- var flt = !isExternal ? this.checkListDiv[colIndex] : _Dom.Dom.id(extFltId);
- var ul = _Dom.Dom.create('ul', ['id', tf.fltIds[colIndex]], ['colIndex', colIndex]);
- ul.className = this.checkListCssClass;
- _Event.Event.add(ul, 'change', function (evt) {
- _this.onChange(evt);
- });
-
- var rows = tf.tbl.rows;
- this.isCustom = tf.hasCustomSlcOptions && _array.Arr.has(tf.customSlcOptions.cols, colIndex);
-
- var activeFlt;
- if (tf.refreshFilters && tf.activeFilterId) {
- activeFlt = tf.activeFilterId.split('_')[0];
- activeFlt = activeFlt.split(tf.prfxFlt)[1];
- }
-
- var excludedOpts,
- filteredDataCol = [];
- if (tf.refreshFilters && tf.disableExcludedOptions) {
- excludedOpts = [];
- }
-
- for (var k = tf.refRow; k < tf.nbRows; k++) {
- // always visible rows don't need to appear on selects as always
- // valid
- if (tf.hasVisibleRows && _array.Arr.has(tf.visibleRows, k) && !tf.paging) {
- continue;
- }
-
- var cells = rows[k].cells;
- var ncells = cells.length;
-
- // checks if row has exact cell #
- if (ncells !== tf.nbCells || this.isCustom) {
- continue;
- }
-
- // this loop retrieves cell data
- for (var j = 0; j < ncells; j++) {
- if (colIndex === j && (!tf.refreshFilters || tf.refreshFilters && tf.disableExcludedOptions) || colIndex === j && tf.refreshFilters && (rows[k].style.display === '' && !tf.paging || tf.paging && (!activeFlt || activeFlt === colIndex || activeFlt != colIndex && _array.Arr.has(tf.validRowsIndex, k)))) {
- var cell_data = tf.getCellData(j, cells[j]);
- //Vary Peter's patch
- var cell_string = _Str.Str.matchCase(cell_data, tf.matchCase);
- // checks if celldata is already in array
- if (!_array.Arr.has(this.opts, cell_string, tf.matchCase)) {
- this.opts.push(cell_data);
- }
- var filteredCol = filteredDataCol[j];
- if (tf.refreshFilters && tf.disableExcludedOptions) {
- if (!filteredCol) {
- filteredDataCol[j] = tf.GetFilteredDataCol(j);
- }
- if (!_array.Arr.has(filteredCol, cell_string, tf.matchCase) && !_array.Arr.has(excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) {
- excludedOpts.push(cell_data);
- }
- }
- }
- }
- }
-
- //Retrieves custom values
- if (this.isCustom) {
- var customValues = tf.__getCustomValues(colIndex);
- this.opts = customValues[0];
- this.optsTxt = customValues[1];
- }
-
- if (tf.sortSlc && !this.isCustom) {
- if (!tf.matchCase) {
- this.opts.sort(_Sort.Sort.ignoreCase);
- if (excludedOpts) {
- excludedOpts.sort(_Sort.Sort.ignoreCase);
- }
- } else {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- }
- }
- //asc sort
- if (tf.sortNumAsc && _array.Arr.has(tf.sortNumAsc, colIndex)) {
- try {
- this.opts.sort(numSortAsc);
- if (excludedOpts) {
- excludedOpts.sort(numSortAsc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(numSortAsc);
- }
- } catch (e) {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- if (this.isCustom) {
- this.optsTxt.sort();
- }
- } //in case there are alphanumeric values
- }
- //desc sort
- if (tf.sortNumDesc && _array.Arr.has(tf.sortNumDesc, colIndex)) {
- try {
- this.opts.sort(numSortDesc);
- if (excludedOpts) {
- excludedOpts.sort(numSortDesc);
- }
- if (this.isCustom) {
- this.optsTxt.sort(numSortDesc);
- }
- } catch (e) {
- this.opts.sort();
- if (excludedOpts) {
- excludedOpts.sort();
- }
- if (this.isCustom) {
- this.optsTxt.sort();
- }
- } //in case there are alphanumeric values
- }
-
- this.addChecks(colIndex, ul, tf.separator);
-
- if (tf.fillSlcOnDemand) {
- flt.innerHTML = '';
- }
- flt.appendChild(ul);
- flt.setAttribute('filled', '1');
- }
- }, {
- key: 'addChecks',
-
- /**
- * Add checklist options
- * @param {Number} colIndex Column index
- * @param {Object} ul Ul element
- * @param {String} separator Data separator
- */
- value: function addChecks(colIndex, ul, separator) {
- var _this2 = this;
-
- var tf = this.tf;
- var chkCt = this.addTChecks(colIndex, ul);
- var flts_values = [],
- fltArr = []; //remember grid values
- var store = tf.Cpt.store;
- var tmpVal = store ? store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null;
- if (tmpVal && _Str.Str.trim(tmpVal).length > 0) {
- if (tf.hasCustomSlcOptions && _array.Arr.has(tf.customSlcOptions.cols, colIndex)) {
- fltArr.push(tmpVal);
- } else {
- fltArr = tmpVal.split(' ' + tf.orOperator + ' ');
- }
- }
-
- for (var y = 0; y < this.opts.length; y++) {
- var val = this.opts[y]; //item value
- var lbl = this.isCustom ? this.optsTxt[y] : val; //item text
- var li = _Dom.Dom.createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl);
- li.className = this.checkListItemCssClass;
- if (tf.refreshFilters && tf.disableExcludedOptions && _array.Arr.has(excludedOpts, _Str.Str.matchCase(val, tf.matchCase), tf.matchCase)) {
- _Dom.Dom.addClass(li, this.checkListItemDisabledCssClass);
- li.check.disabled = true;
- li.disabled = true;
- } else {
- _Event.Event.add(li.check, 'click', function (evt) {
- _this2.optionClick(evt);
- });
- }
- ul.appendChild(li);
-
- if (val === '') {
- //item is hidden
- li.style.display = 'none';
- }
-
- /*** remember grid values ***/
- if (tf.rememberGridValues) {
- if (tf.hasCustomSlcOptions && _array.Arr.has(tf.customSlcOptions.cols, colIndex) && fltArr.toString().indexOf(val) != -1 || _array.Arr.has(fltArr, _Str.Str.matchCase(val, tf.matchCase), tf.matchCase)) {
- li.check.checked = true;
- this.setCheckListValues(li.check);
- }
- }
- }
- }
- }, {
- key: 'addTChecks',
-
- /**
- * Add checklist header option
- * @param {Number} colIndex Column index
- * @param {Object} ul Ul element
- */
- value: function addTChecks(colIndex, ul) {
- var _this3 = this;
-
- var tf = this.tf;
- var chkCt = 1;
- var li0 = _Dom.Dom.createCheckItem(tf.fltIds[colIndex] + '_0', '', tf.displayAllText);
- li0.className = this.checkListItemCssClass;
- ul.appendChild(li0);
-
- _Event.Event.add(li0.check, 'click', function (evt) {
- _this3.optionClick(evt);
- });
-
- if (!this.enableCheckListResetFilter) {
- li0.style.display = 'none';
- }
-
- if (tf.enableEmptyOption) {
- var li1 = _Dom.Dom.createCheckItem(tf.fltIds[colIndex] + '_1', tf.emOperator, tf.emptyText);
- li1.className = this.checkListItemCssClass;
- ul.appendChild(li1);
- _Event.Event.add(li1.check, 'click', function (evt) {
- _this3.optionClick(evt);
- });
- chkCt++;
- }
-
- if (tf.enableNonEmptyOption) {
- var li2 = _Dom.Dom.createCheckItem(tf.fltIds[colIndex] + '_2', tf.nmOperator, tf.nonEmptyText);
- li2.className = this.checkListItemCssClass;
- ul.appendChild(li2);
- _Event.Event.add(li2.check, 'click', function (evt) {
- _this3.optionClick(evt);
- });
- chkCt++;
- }
- return chkCt;
- }
- }, {
- key: 'setCheckListValues',
-
- /**
- * Store checked options in DOM element attribute
- * @param {Object} o checklist option DOM element
- */
- value: function setCheckListValues(o) {
- if (!o) {
- return;
- }
- var tf = this.tf;
- var chkValue = o.value; //checked item value
- var chkIndex = parseInt(o.id.split('_')[2], 10);
- var filterTag = 'ul',
- itemTag = 'li';
- var n = o;
-
- //ul tag search
- while (_Str.Str.lower(n.nodeName) !== filterTag) {
- n = n.parentNode;
- }
-
- var li = n.childNodes[chkIndex];
- var colIndex = n.getAttribute('colIndex');
- var fltValue = n.getAttribute('value'); //filter value (ul tag)
- var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag)
-
- if (o.checked) {
- //show all item
- if (chkValue === '') {
- if (fltIndexes && fltIndexes !== '') {
- //items indexes
- var indSplit = fltIndexes.split(tf.separator);
- //checked items loop
- for (var u = 0; u < indSplit.length; u++) {
- //checked item
- var cChk = _Dom.Dom.id(tf.fltIds[colIndex] + '_' + indSplit[u]);
- if (cChk) {
- cChk.checked = false;
- _Dom.Dom.removeClass(n.childNodes[indSplit[u]], this.checkListSlcItemCssClass);
- }
- }
- }
- n.setAttribute('value', '');
- n.setAttribute('indexes', '');
- } else {
- fltValue = fltValue ? fltValue : '';
- chkValue = _Str.Str.trim(fltValue + ' ' + chkValue + ' ' + tf.orOperator);
- chkIndex = fltIndexes + chkIndex + tf.separator;
- n.setAttribute('value', chkValue);
- n.setAttribute('indexes', chkIndex);
- //1st option unchecked
- if (_Dom.Dom.id(tf.fltIds[colIndex] + '_0')) {
- _Dom.Dom.id(tf.fltIds[colIndex] + '_0').checked = false;
- }
- }
-
- if (_Str.Str.lower(li.nodeName) === itemTag) {
- _Dom.Dom.removeClass(n.childNodes[0], this.checkListSlcItemCssClass);
- _Dom.Dom.addClass(li, this.checkListSlcItemCssClass);
- }
- } else {
- //removes values and indexes
- if (chkValue !== '') {
- var replaceValue = new RegExp(_Str.Str.rgxEsc(chkValue + ' ' + tf.orOperator));
- fltValue = fltValue.replace(replaceValue, '');
- n.setAttribute('value', _Str.Str.trim(fltValue));
-
- var replaceIndex = new RegExp(_Str.Str.rgxEsc(chkIndex + tf.separator));
- fltIndexes = fltIndexes.replace(replaceIndex, '');
- n.setAttribute('indexes', fltIndexes);
- }
- if (_Str.Str.lower(li.nodeName) === itemTag) {
- _Dom.Dom.removeClass(li, this.checkListSlcItemCssClass);
- }
- }
- }
- }]);
-
- return CheckList;
- })();
-
- exports.CheckList = CheckList;
-
-/***/ },
-/* 18 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _Types = __webpack_require__(6);
-
- var _Helpers = __webpack_require__(8);
-
- var RowsCounter = (function () {
-
- /**
- * Rows counter
- * @param {Object} tf TableFilter instance
- */
-
- function RowsCounter(tf) {
- _classCallCheck(this, RowsCounter);
-
- // TableFilter configuration
- var f = tf.config();
-
- //id of custom container element
- this.rowsCounterTgtId = f.rows_counter_target_id || null;
- //element containing tot nb rows
- this.rowsCounterDiv = null;
- //element containing tot nb rows label
- this.rowsCounterSpan = null;
- //defines rows counter text
- this.rowsCounterText = f.rows_counter_text || 'Rows: ';
- this.fromToTextSeparator = f.from_to_text_separator || '-';
- this.overText = f.over_text || ' / ';
- //defines css class rows counter
- this.totRowsCssClass = f.tot_rows_css_class || 'tot';
- //rows counter div
- this.prfxCounter = 'counter_';
- //nb displayed rows label
- this.prfxTotRows = 'totrows_span_';
- //label preceding nb rows label
- this.prfxTotRowsTxt = 'totRowsTextSpan_';
- //callback raised before counter is refreshed
- this.onBeforeRefreshCounter = _Types.Types.isFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null;
- //callback raised after counter is refreshed
- this.onAfterRefreshCounter = _Types.Types.isFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null;
-
- this.tf = tf;
- }
-
- _createClass(RowsCounter, [{
- key: 'init',
- value: function init() {
- var tf = this.tf;
-
- if (!tf.hasGrid() && !tf.isFirstLoad || this.rowsCounterSpan) {
- return;
- }
-
- //rows counter container
- var countDiv = _Dom.Dom.create('div', ['id', this.prfxCounter + tf.id]);
- countDiv.className = this.totRowsCssClass;
- //rows counter label
- var countSpan = _Dom.Dom.create('span', ['id', this.prfxTotRows + tf.id]);
- var countText = _Dom.Dom.create('span', ['id', this.prfxTotRowsTxt + tf.id]);
- countText.appendChild(_Dom.Dom.text(this.rowsCounterText));
-
- // counter is added to defined element
- if (!this.rowsCounterTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.rowsCounterTgtId ? tf.lDiv : _Dom.Dom.id(this.rowsCounterTgtId);
-
- //IE only: clears all for sure
- if (this.rowsCounterDiv && _Helpers.Helpers.isIE()) {
- this.rowsCounterDiv.outerHTML = '';
- }
- //default container: 'lDiv'
- if (!this.rowsCounterTgtId) {
- countDiv.appendChild(countText);
- countDiv.appendChild(countSpan);
- targetEl.appendChild(countDiv);
- } else {
- //custom container, no need to append statusDiv
- targetEl.appendChild(countText);
- targetEl.appendChild(countSpan);
- }
- this.rowsCounterDiv = countDiv;
- this.rowsCounterSpan = countSpan;
-
- this.refresh();
- }
- }, {
- key: 'refresh',
- value: function refresh(p) {
- if (!this.rowsCounterSpan) {
- return;
- }
-
- var tf = this.tf;
-
- if (this.onBeforeRefreshCounter) {
- this.onBeforeRefreshCounter.call(null, tf, this.rowsCounterSpan);
- }
-
- var totTxt;
- if (!tf.paging) {
- if (p && p !== '') {
- totTxt = p;
- } else {
- totTxt = tf.nbFilterableRows - tf.nbHiddenRows - (tf.hasVisibleRows ? tf.visibleRows.length : 0);
- }
- } else {
- var paging = tf.Cpt.paging;
- if (paging) {
- //paging start row
- var paging_start_row = parseInt(paging.startPagingRow, 10) + (tf.nbVisibleRows > 0 ? 1 : 0);
- var paging_end_row = paging_start_row + paging.pagingLength - 1 <= tf.nbVisibleRows ? paging_start_row + paging.pagingLength - 1 : tf.nbVisibleRows;
- totTxt = paging_start_row + this.fromToTextSeparator + paging_end_row + this.overText + tf.nbVisibleRows;
- }
- }
- this.rowsCounterSpan.innerHTML = totTxt;
- if (this.onAfterRefreshCounter) {
- this.onAfterRefreshCounter.call(null, tf, this.rowsCounterSpan, totTxt);
- }
- }
- }, {
- key: 'destroy',
- value: function destroy() {
- var tf = this.tf;
- if (!tf.hasGrid()) {
- return;
- }
- if (!this.rowsCounterSpan) {
- return;
- }
-
- if (!this.rowsCounterTgtId && this.rowsCounterDiv) {
- //IE only: clears all for sure
- if (_Helpers.Helpers.isIE()) {
- this.rowsCounterDiv.outerHTML = '';
- } else {
- this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv);
- }
- } else {
- _Dom.Dom.id(this.rowsCounterTgtId).innerHTML = '';
- }
- this.rowsCounterSpan = null;
- this.rowsCounterDiv = null;
- }
- }]);
-
- return RowsCounter;
- })();
-
- exports.RowsCounter = RowsCounter;
-
-/***/ },
-/* 19 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _Event = __webpack_require__(2);
-
- var _Types = __webpack_require__(6);
-
- var _Helpers = __webpack_require__(8);
-
- var global = window;
-
- var StatusBar = (function () {
-
- /**
- * Status bar UI component
- * @param {Object} tf TableFilter instance
- */
-
- function StatusBar(tf) {
- _classCallCheck(this, StatusBar);
-
- // Configuration object
- var f = tf.config();
-
- //id of custom container element
- this.statusBarTgtId = f.status_bar_target_id || null;
- //element containing status bar label
- this.statusBarDiv = null;
- //status bar
- this.statusBarSpan = null;
- //status bar label
- this.statusBarSpanText = null;
- //defines status bar text
- this.statusBarText = f.status_bar_text || '';
- //defines css class status bar
- this.statusBarCssClass = f.status_bar_css_class || 'status';
- //delay for status bar clearing
- this.statusBarCloseDelay = 250;
-
- //calls function before message is displayed
- this.onBeforeShowMsg = _Types.Types.isFn(f.on_before_show_msg) ? f.on_before_show_msg : null;
- //calls function after message is displayed
- this.onAfterShowMsg = _Types.Types.isFn(f.on_after_show_msg) ? f.on_after_show_msg : null;
-
- // status bar div
- this.prfxStatus = 'status_';
- // status bar label
- this.prfxStatusSpan = 'statusSpan_';
- // text preceding status bar label
- this.prfxStatusTxt = 'statusText_';
-
- this.tf = tf;
- }
-
- _createClass(StatusBar, [{
- key: 'init',
- value: function init() {
- var tf = this.tf;
- if (!tf.hasGrid() && !tf.isFirstLoad) {
- return;
- }
-
- //status bar container
- var statusDiv = _Dom.Dom.create('div', ['id', this.prfxStatus + tf.id]);
- statusDiv.className = this.statusBarCssClass;
-
- //status bar label
- var statusSpan = _Dom.Dom.create('span', ['id', this.prfxStatusSpan + tf.id]);
- //preceding text
- var statusSpanText = _Dom.Dom.create('span', ['id', this.prfxStatusTxt + tf.id]);
- statusSpanText.appendChild(_Dom.Dom.text(this.statusBarText));
-
- // target element container
- if (!this.statusBarTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.statusBarTgtId ? tf.lDiv : _Dom.Dom.id(this.statusBarTgtId);
-
- // TODO: use alternative to outerHTML
- if (this.statusBarDiv && _Helpers.Helpers.isIE()) {
- this.statusBarDiv.outerHTML = '';
- }
-
- //default container: 'lDiv'
- if (!this.statusBarTgtId) {
- statusDiv.appendChild(statusSpanText);
- statusDiv.appendChild(statusSpan);
- targetEl.appendChild(statusDiv);
- } else {
- // custom container, no need to append statusDiv
- targetEl.appendChild(statusSpanText);
- targetEl.appendChild(statusSpan);
- }
-
- this.statusBarDiv = statusDiv;
- this.statusBarSpan = statusSpan;
- this.statusBarSpanText = statusSpanText;
- }
- }, {
- key: 'message',
- value: function message() {
- var _this = this;
-
- var t = arguments[0] === undefined ? '' : arguments[0];
-
- var tf = this.tf;
- if (!tf.statusBar || !this.statusBarSpan) {
- return;
- }
- if (this.onBeforeShowMsg) {
- this.onBeforeShowMsg.call(null, this.tf, t);
- }
-
- var d = t === '' ? this.statusBarCloseDelay : 1;
- global.setTimeout(function () {
- _this.statusBarSpan.innerHTML = t;
- if (_this.onAfterShowMsg) {
- _this.onAfterShowMsg.call(null, _this.tf, t);
- }
- }, d);
- }
- }, {
- key: 'destroy',
- value: function destroy() {
- var tf = this.tf;
- if (!tf.hasGrid() || !this.statusBarDiv) {
- return;
- }
-
- this.statusBarDiv.innerHTML = '';
- this.statusBarDiv.parentNode.removeChild(this.statusBarDiv);
- this.statusBarSpan = null;
- this.statusBarSpanText = null;
- this.statusBarDiv = null;
- }
- }]);
-
- return StatusBar;
- })();
-
- exports.StatusBar = StatusBar;
-
-/***/ },
-/* 20 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _Types = __webpack_require__(6);
-
- var _Str = __webpack_require__(4);
-
- var _Helpers = __webpack_require__(8);
-
- var _Event = __webpack_require__(2);
-
- var Paging = (function () {
-
- /**
- * Pagination component
- * @param {Object} tf TableFilter instance
- */
-
- function Paging(tf) {
- _classCallCheck(this, Paging);
-
- // Configuration object
- var f = tf.config();
-
- //css class for paging buttons (previous,next,etc.)
- this.btnPageCssClass = f.paging_btn_css_class || 'pgInp';
- //stores paging select element
- this.pagingSlc = null;
- //results per page select element
- this.resultsPerPageSlc = null;
- //id of container element
- this.pagingTgtId = f.paging_target_id || null;
- //defines table paging length
- this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10;
- //id of container element
- this.resultsPerPageTgtId = f.results_per_page_target_id || null;
- //css class for paging select element
- this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc';
- //css class for paging input element
- this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp';
- //stores results per page text and values
- this.resultsPerPage = f.results_per_page || null;
- //enables/disables results per page drop-down
- this.hasResultsPerPage = _Types.Types.isArray(this.resultsPerPage);
- //defines css class for results per page select
- this.resultsSlcCssClass = f.results_slc_css_class || 'rspg';
- //css class for label preceding results per page select
- this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan';
- //1st row index of current page
- this.startPagingRow = 0;
- //total nb of pages
- this.nbPages = 0;
- //current page nb
- this.currentPageNb = 1;
- //defines next page button text
- this.btnNextPageText = f.btn_next_page_text || '>';
- //defines previous page button text
- this.btnPrevPageText = f.btn_prev_page_text || '<';
- //defines last page button text
- this.btnLastPageText = f.btn_last_page_text || '>|';
- //defines first page button text
- this.btnFirstPageText = f.btn_first_page_text || '|<';
- //defines next page button html
- this.btnNextPageHtml = f.btn_next_page_html || (!tf.enableIcons ? null : ' ');
- //defines previous page button html
- this.btnPrevPageHtml = f.btn_prev_page_html || (!tf.enableIcons ? null : ' ');
- //defines last page button html
- this.btnFirstPageHtml = f.btn_first_page_html || (!tf.enableIcons ? null : ' ');
- //defines previous page button html
- this.btnLastPageHtml = f.btn_last_page_html || (!tf.enableIcons ? null : ' ');
- //defines text preceeding page selector drop-down
- this.pageText = f.page_text || ' Page ';
- //defines text after page selector drop-down
- this.ofText = f.of_text || ' of ';
- //css class for span containing tot nb of pages
- this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg';
- //enables/disables paging buttons
- this.hasPagingBtns = f.paging_btns === false ? false : true;
- //defines previous page button html
- this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc;
- //calls function before page is changed
- this.onBeforeChangePage = _Types.Types.isFn(f.on_before_change_page) ? f.on_before_change_page : null;
- //calls function before page is changed
- this.onAfterChangePage = _Types.Types.isFn(f.on_after_change_page) ? f.on_after_change_page : null;
-
- //pages select
- this.prfxSlcPages = 'slcPages_';
- //results per page select
- this.prfxSlcResults = 'slcResults_';
- //label preciding results per page select
- this.prfxSlcResultsTxt = 'slcResultsTxt_';
- //span containing next page button
- this.prfxBtnNextSpan = 'btnNextSpan_';
- //span containing previous page button
- this.prfxBtnPrevSpan = 'btnPrevSpan_';
- //span containing last page button
- this.prfxBtnLastSpan = 'btnLastSpan_';
- //span containing first page button
- this.prfxBtnFirstSpan = 'btnFirstSpan_';
- //next button
- this.prfxBtnNext = 'btnNext_';
- //previous button
- this.prfxBtnPrev = 'btnPrev_';
- //last button
- this.prfxBtnLast = 'btnLast_';
- //first button
- this.prfxBtnFirst = 'btnFirst_';
- //span for tot nb pages
- this.prfxPgSpan = 'pgspan_';
- //span preceding pages select (contains 'Page')
- this.prfxPgBeforeSpan = 'pgbeforespan_';
- //span following pages select (contains ' of ')
- this.prfxPgAfterSpan = 'pgafterspan_';
-
- var start_row = this.refRow;
- var nrows = this.nbRows;
- //calculates page nb
- this.nbPages = Math.ceil((nrows - start_row) / this.pagingLength);
-
- //Paging elements events
- var o = this;
- // Paging DOM events
- this.evt = {
- slcIndex: function slcIndex() {
- return o.pageSelectorType === tf.fltTypeSlc ? o.pagingSlc.options.selectedIndex : parseInt(o.pagingSlc.value, 10) - 1;
- },
- nbOpts: function nbOpts() {
- return o.pageSelectorType === tf.fltTypeSlc ? parseInt(o.pagingSlc.options.length, 10) - 1 : o.nbPages - 1;
- },
- next: function next() {
- var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? o.evt.slcIndex() + 1 : 0;
- o.changePage(nextIndex);
- },
- prev: function prev() {
- var prevIndex = o.evt.slcIndex() > 0 ? o.evt.slcIndex() - 1 : o.evt.nbOpts();
- o.changePage(prevIndex);
- },
- last: function last() {
- o.changePage(o.evt.nbOpts());
- },
- first: function first() {
- o.changePage(0);
- },
- _detectKey: function _detectKey(e) {
- var key = _Event.Event.keyCode(e);
- if (key === 13) {
- if (tf.sorted) {
- tf.filter();
- o.changePage(o.evt.slcIndex());
- } else {
- o.changePage();
- }
- this.blur();
- }
- },
- slcPagesChange: null,
- nextEvt: null,
- prevEvt: null,
- lastEvt: null,
- firstEvt: null
- };
-
- this.tf = tf;
- }
-
- _createClass(Paging, [{
- key: 'init',
-
- /**
- * Initialize DOM elements
- */
- value: function init() {
- var _this = this;
-
- var slcPages;
- var tf = this.tf;
- var evt = this.evt;
-
- // Check resultsPerPage is in expected format and initialise the
- // results per page component
- if (this.hasResultsPerPage) {
- if (this.resultsPerPage.length < 2) {
- this.hasResultsPerPage = false;
- } else {
- this.pagingLength = this.resultsPerPage[1][0];
- this.setResultsPerPage();
- }
- }
-
- /*====================================================
- - onchange event for paging select
- =====================================================*/
- evt.slcPagesChange = function (event) {
- _this.changePage();
- event.target.blur();
- };
-
- // Paging drop-down list selector
- if (this.pageSelectorType === tf.fltTypeSlc) {
- slcPages = _Dom.Dom.create(tf.fltTypeSlc, ['id', this.prfxSlcPages + tf.id]);
- slcPages.className = this.pgSlcCssClass;
- _Event.Event.add(slcPages, 'change', evt.slcPagesChange);
- }
-
- // Paging input selector
- if (this.pageSelectorType === tf.fltTypeInp) {
- slcPages = _Dom.Dom.create(tf.fltTypeInp, ['id', this.prfxSlcPages + tf.id], ['value', this.currentPageNb]);
- slcPages.className = this.pgInpCssClass;
- _Event.Event.add(slcPages, 'keypress', evt._detectKey);
- }
-
- // btns containers
- var btnNextSpan = _Dom.Dom.create('span', ['id', this.prfxBtnNextSpan + tf.id]);
- var btnPrevSpan = _Dom.Dom.create('span', ['id', this.prfxBtnPrevSpan + tf.id]);
- var btnLastSpan = _Dom.Dom.create('span', ['id', this.prfxBtnLastSpan + tf.id]);
- var btnFirstSpan = _Dom.Dom.create('span', ['id', this.prfxBtnFirstSpan + tf.id]);
-
- if (this.hasPagingBtns) {
- // Next button
- if (!this.btnNextPageHtml) {
- var btn_next = _Dom.Dom.create(tf.fltTypeInp, ['id', this.prfxBtnNext + tf.id], ['type', 'button'], ['value', this.btnNextPageText], ['title', 'Next']);
- btn_next.className = this.btnPageCssClass;
- _Event.Event.add(btn_next, 'click', evt.next);
- btnNextSpan.appendChild(btn_next);
- } else {
- btnNextSpan.innerHTML = this.btnNextPageHtml;
- _Event.Event.add(btnNextSpan, 'click', evt.next);
- }
- // Previous button
- if (!this.btnPrevPageHtml) {
- var btn_prev = _Dom.Dom.create(tf.fltTypeInp, ['id', this.prfxBtnPrev + tf.id], ['type', 'button'], ['value', this.btnPrevPageText], ['title', 'Previous']);
- btn_prev.className = this.btnPageCssClass;
- _Event.Event.add(btn_prev, 'click', evt.prev);
- btnPrevSpan.appendChild(btn_prev);
- } else {
- btnPrevSpan.innerHTML = this.btnPrevPageHtml;
- _Event.Event.add(btnPrevSpan, 'click', evt.prev);
- }
- // Last button
- if (!this.btnLastPageHtml) {
- var btn_last = _Dom.Dom.create(tf.fltTypeInp, ['id', this.prfxBtnLast + tf.id], ['type', 'button'], ['value', this.btnLastPageText], ['title', 'Last']);
- btn_last.className = this.btnPageCssClass;
- _Event.Event.add(btn_last, 'click', evt.last);
- btnLastSpan.appendChild(btn_last);
- } else {
- btnLastSpan.innerHTML = this.btnLastPageHtml;
- _Event.Event.add(btnLastSpan, 'click', evt.last);
- }
- // First button
- if (!this.btnFirstPageHtml) {
- var btn_first = _Dom.Dom.create(tf.fltTypeInp, ['id', this.prfxBtnFirst + tf.id], ['type', 'button'], ['value', this.btnFirstPageText], ['title', 'First']);
- btn_first.className = this.btnPageCssClass;
- _Event.Event.add(btn_first, 'click', evt.first);
- btnFirstSpan.appendChild(btn_first);
- } else {
- btnFirstSpan.innerHTML = this.btnFirstPageHtml;
- _Event.Event.add(btnFirstSpan, 'click', evt.first);
- }
- }
-
- // paging elements (buttons+drop-down list) are added to defined element
- if (!this.pagingTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.pagingTgtId ? tf.mDiv : _Dom.Dom.id(this.pagingTgtId);
- targetEl.appendChild(btnFirstSpan);
- targetEl.appendChild(btnPrevSpan);
-
- var pgBeforeSpan = _Dom.Dom.create('span', ['id', this.prfxPgBeforeSpan + tf.id]);
- pgBeforeSpan.appendChild(_Dom.Dom.text(this.pageText));
- pgBeforeSpan.className = this.nbPgSpanCssClass;
- targetEl.appendChild(pgBeforeSpan);
- targetEl.appendChild(slcPages);
- var pgAfterSpan = _Dom.Dom.create('span', ['id', this.prfxPgAfterSpan + tf.id]);
- pgAfterSpan.appendChild(_Dom.Dom.text(this.ofText));
- pgAfterSpan.className = this.nbPgSpanCssClass;
- targetEl.appendChild(pgAfterSpan);
- var pgspan = _Dom.Dom.create('span', ['id', this.prfxPgSpan + tf.id]);
- pgspan.className = this.nbPgSpanCssClass;
- pgspan.appendChild(_Dom.Dom.text(' ' + this.nbPages + ' '));
- targetEl.appendChild(pgspan);
- targetEl.appendChild(btnNextSpan);
- targetEl.appendChild(btnLastSpan);
- this.pagingSlc = _Dom.Dom.id(this.prfxSlcPages + tf.id);
-
- // if this.rememberGridValues==true this.setPagingInfo() is called
- // in ResetGridValues() method
- if (!tf.rememberGridValues || this.isPagingRemoved) {
- this.setPagingInfo();
- }
- if (!tf.fltGrid) {
- tf.ValidateAllRows();
- this.setPagingInfo(tf.validRowsIndex);
- }
-
- this.isPagingRemoved = false;
- }
- }, {
- key: 'addPaging',
-
- /**
- * Add paging when filters are already instanciated
- * @param {Boolean} filterTable Execute filtering once paging instanciated
- */
- value: function addPaging() {
- var filterTable = arguments[0] === undefined ? false : arguments[0];
-
- var tf = this.tf;
- if (!tf.hasGrid() || tf.paging) {
- return;
- }
- tf.paging = true;
- this.isPagingRemoved = true;
- this.init();
- tf.resetValues();
- if (filterTable) {
- tf.filter();
- }
- }
- }, {
- key: 'setPagingInfo',
-
- /**
- * Calculate number of pages based on valid rows
- * Refresh paging select according to number of pages
- * @param {Array} validRows Collection of valid rows
- */
- value: function setPagingInfo(validRows) {
- var tf = this.tf;
- var rows = tf.tbl.rows;
- var mdiv = !this.pagingTgtId ? tf.mDiv : _Dom.Dom.id(this.pagingTgtId);
- var pgspan = _Dom.Dom.id(this.prfxPgSpan + tf.id);
- //stores valid rows indexes
- if (validRows && validRows.length > 0) {
- tf.validRowsIndex = validRows;
- } else {
- //re-sets valid rows indexes array
- tf.validRowsIndex = [];
-
- //counts rows to be grouped
- for (var j = tf.refRow; j < tf.nbRows; j++) {
- var row = rows[j];
- if (!row) {
- continue;
- }
- var isRowValid = row.getAttribute('validRow');
- if (isRowValid === 'true' || !isRowValid) {
- tf.validRowsIndex.push(j);
- }
- }
- }
-
- //calculate nb of pages
- this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength);
- //refresh page nb span
- pgspan.innerHTML = this.nbPages;
- //select clearing shortcut
- if (this.pageSelectorType === tf.fltTypeSlc) {
- this.pagingSlc.innerHTML = '';
- }
-
- if (this.nbPages > 0) {
- mdiv.style.visibility = 'visible';
- if (this.pageSelectorType === tf.fltTypeSlc) {
- for (var z = 0; z < this.nbPages; z++) {
- var currOpt = new Option(z + 1, z * this.pagingLength, false, false);
- this.pagingSlc.options[z] = currOpt;
- }
- } else {
- //input type
- this.pagingSlc.value = this.currentPageNb;
- }
- } else {
- /*** if no results paging select and buttons are hidden ***/
- mdiv.style.visibility = 'hidden';
- }
- this.groupByPage(tf.validRowsIndex);
- }
- }, {
- key: 'groupByPage',
-
- /**
- * Group table rows by page and display valid rows
- * @param {Array} validRows Collection of valid rows
- */
- value: function groupByPage(validRows) {
- var tf = this.tf;
- var rows = tf.tbl.rows;
- var paging_end_row = parseInt(this.startPagingRow, 10) + parseInt(this.pagingLength, 10);
-
- //store valid rows indexes
- if (validRows) {
- tf.validRowsIndex = validRows;
- }
-
- //this loop shows valid rows of current page
- for (var h = 0; h < tf.validRowsIndex.length; h++) {
- var r = rows[tf.validRowsIndex[h]];
- if (h >= this.startPagingRow && h < paging_end_row) {
- if (r.getAttribute('validRow') === 'true' || !r.getAttribute('validRow')) {
- r.style.display = '';
- }
- if (tf.alternateBgs && tf.Cpt.alternateRows) {
- tf.Cpt.alternateRows.setRowBg(tf.validRowsIndex[h], h);
- }
- } else {
- r.style.display = 'none';
- if (tf.alternateBgs && tf.Cpt.alternateRows) {
- tf.Cpt.alternateRows.removeRowBg(tf.validRowsIndex[h]);
- }
- }
- }
-
- tf.nbVisibleRows = tf.validRowsIndex.length;
- tf.isStartBgAlternate = false;
- //re-applies filter behaviours after filtering process
- tf.applyGridProps();
- }
- }, {
- key: 'setPage',
-
- /**
- * Show page based on passed param value (string or number):
- * @param {String} or {Number} cmd possible string values: 'next',
- * 'previous', 'last', 'first' or page number as per param
- */
- value: function setPage(cmd) {
- var tf = this.tf;
- if (!tf.hasGrid() || !tf.paging) {
- return;
- }
- var btnEvt = this.evt,
- cmdtype = typeof cmd;
- if (cmdtype === 'string') {
- switch (_Str.Str.lower(cmd)) {
- case 'next':
- btnEvt.next();
- break;
- case 'previous':
- btnEvt.prev();
- break;
- case 'last':
- btnEvt.last();
- break;
- case 'first':
- btnEvt.first();
- break;
- default:
- btnEvt.next();
- break;
- }
- } else if (cmdtype === 'number') {
- this.changePage(cmd - 1);
- }
- }
- }, {
- key: 'setResultsPerPage',
-
- /**
- * Generates UI elements for the number of results per page drop-down
- */
- value: function setResultsPerPage() {
- var _this2 = this;
-
- var tf = this.tf;
- var evt = this.evt;
-
- if (!tf.hasGrid() && !tf.isFirstLoad) {
- return;
- }
- if (this.resultsPerPageSlc || !this.resultsPerPage) {
- return;
- }
-
- /*====================================================
- - onchange event for results per page select
- =====================================================*/
- evt.slcResultsChange = function (ev) {
- _this2.changeResultsPerPage();
- ev.target.blur();
- };
-
- var slcR = _Dom.Dom.create(tf.fltTypeSlc, ['id', this.prfxSlcResults + tf.id]);
- slcR.className = tf.resultsSlcCssClass;
- var slcRText = this.resultsPerPage[0],
- slcROpts = this.resultsPerPage[1];
- var slcRSpan = _Dom.Dom.create('span', ['id', this.prfxSlcResultsTxt + tf.id]);
- slcRSpan.className = this.resultsSpanCssClass;
-
- // results per page select is added to external element
- if (!this.resultsPerPageTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : _Dom.Dom.id(this.resultsPerPageTgtId);
- slcRSpan.appendChild(_Dom.Dom.text(slcRText));
- targetEl.appendChild(slcRSpan);
- targetEl.appendChild(slcR);
-
- this.resultsPerPageSlc = _Dom.Dom.id(this.prfxSlcResults + tf.id);
-
- for (var r = 0; r < slcROpts.length; r++) {
- var currOpt = new Option(slcROpts[r], slcROpts[r], false, false);
- this.resultsPerPageSlc.options[r] = currOpt;
- }
- _Event.Event.add(slcR, 'change', evt.slcResultsChange);
- }
- }, {
- key: 'removeResultsPerPage',
-
- /**
- * Remove number of results per page UI elements
- */
- value: function removeResultsPerPage() {
- var tf = this.tf;
- if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) {
- return;
- }
- var slcR = this.resultsPerPageSlc,
- slcRSpan = _Dom.Dom.id(this.prfxSlcResultsTxt + tf.id);
- if (slcR) {
- slcR.parentNode.removeChild(slcR);
- }
- if (slcRSpan) {
- slcRSpan.parentNode.removeChild(slcRSpan);
- }
- this.resultsPerPageSlc = null;
- }
- }, {
- key: 'changePage',
-
- /**
- * Change the page asynchronously according to passed index
- * @param {Number} index Index of the page (0-n)
- */
- value: function changePage(index) {
- var tf = this.tf;
- var evt = tf.Evt;
- tf.EvtManager(evt.name.changepage, { pgIndex: index });
- }
- }, {
- key: 'changeResultsPerPage',
-
- /**
- * Change rows asynchronously according to page results
- */
- value: function changeResultsPerPage() {
- var tf = this.tf;
- var evt = tf.Evt;
- tf.EvtManager(evt.name.changeresultsperpage);
- }
- }, {
- key: 'resetPage',
-
- /**
- * Re-set asynchronously page nb at page re-load
- */
- value: function resetPage() {
- var tf = this.tf;
- var evt = tf.Evt;
- tf.EvtManager(evt.name.resetpage);
- }
- }, {
- key: 'resetPageLength',
-
- /**
- * Re-set asynchronously page length at page re-load
- */
- value: function resetPageLength() {
- var tf = this.tf;
- var evt = tf.Evt;
- tf.EvtManager(evt.name.resetpagelength);
- }
- }, {
- key: '_changePage',
-
- /**
- * Change the page according to passed index
- * @param {Number} index Index of the page (0-n)
- */
- value: function _changePage(index) {
- var tf = this.tf;
-
- if (!tf.paging) {
- return;
- }
- if (index === null) {
- index = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1;
- }
- if (index >= 0 && index <= this.nbPages - 1) {
- if (this.onBeforeChangePage) {
- this.onBeforeChangePage.call(null, this, index);
- }
- this.currentPageNb = parseInt(index, 10) + 1;
- if (this.pageSelectorType === tf.fltTypeSlc) {
- this.pagingSlc.options[index].selected = true;
- } else {
- this.pagingSlc.value = this.currentPageNb;
- }
-
- if (tf.rememberPageNb) {
- tf.Cpt.store.savePageNb(tf.pgNbCookie);
- }
- this.startPagingRow = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.value : index * this.pagingLength;
-
- this.groupByPage();
-
- if (this.onAfterChangePage) {
- this.onAfterChangePage.call(null, this, index);
- }
- }
- }
- }, {
- key: '_changeResultsPerPage',
-
- /**
- * Change rows according to page results
- */
- value: function _changeResultsPerPage() {
- var tf = this.tf;
-
- if (!tf.paging) {
- return;
- }
- var slcR = this.resultsPerPageSlc;
- var slcPagesSelIndex = this.pageSelectorType === tf.fltTypeSlc ? this.pagingSlc.selectedIndex : parseInt(this.pagingSlc.value - 1, 10);
- this.pagingLength = parseInt(slcR.options[slcR.selectedIndex].value, 10);
- this.startPagingRow = this.pagingLength * slcPagesSelIndex;
-
- if (!isNaN(this.pagingLength)) {
- if (this.startPagingRow >= tf.nbFilterableRows) {
- this.startPagingRow = tf.nbFilterableRows - this.pagingLength;
- }
- this.setPagingInfo();
-
- if (this.pageSelectorType === tf.fltTypeSlc) {
- var slcIndex = this.pagingSlc.options.length - 1 <= slcPagesSelIndex ? this.pagingSlc.options.length - 1 : slcPagesSelIndex;
- this.pagingSlc.options[slcIndex].selected = true;
- }
- if (tf.rememberPageLen) {
- tf.Cpt.store.savePageLength(tf.pgLenCookie);
- }
- }
- }
- }, {
- key: '_resetPage',
-
- /**
- * Re-set page nb at page re-load
- */
- value: function _resetPage(name) {
- var tf = this.tf;
- var pgnb = tf.Cpt.store.getPageNb(name);
- if (pgnb !== '') {
- this.changePage(pgnb - 1);
- }
- }
- }, {
- key: '_resetPageLength',
-
- /**
- * Re-set page length at page re-load
- */
- value: function _resetPageLength(name) {
- var tf = this.tf;
- if (!tf.paging) {
- return;
- }
- var pglenIndex = tf.Cpt.store.getPageLength(name);
-
- if (pglenIndex !== '') {
- this.resultsPerPageSlc.options[pglenIndex].selected = true;
- this.changeResultsPerPage();
- }
- }
- }, {
- key: 'destroy',
-
- /**
- * Remove paging feature
- */
- value: function destroy() {
- var tf = this.tf;
-
- if (!tf.hasGrid()) {
- return;
- }
- // btns containers
- var btnNextSpan, btnPrevSpan, btnLastSpan, btnFirstSpan;
- var pgBeforeSpan, pgAfterSpan, pgspan;
- btnNextSpan = _Dom.Dom.id(this.prfxBtnNextSpan + tf.id);
- btnPrevSpan = _Dom.Dom.id(this.prfxBtnPrevSpan + tf.id);
- btnLastSpan = _Dom.Dom.id(this.prfxBtnLastSpan + tf.id);
- btnFirstSpan = _Dom.Dom.id(this.prfxBtnFirstSpan + tf.id);
- //span containing 'Page' text
- pgBeforeSpan = _Dom.Dom.id(this.prfxPgBeforeSpan + tf.id);
- //span containing 'of' text
- pgAfterSpan = _Dom.Dom.id(this.prfxPgAfterSpan + tf.id);
- //span containing nb of pages
- pgspan = _Dom.Dom.id(this.prfxPgSpan + tf.id);
-
- var evt = this.evt;
-
- if (this.pagingSlc) {
- if (this.pageSelectorType === tf.fltTypeSlc) {
- _Event.Event.remove(this.pagingSlc, 'change', evt.slcPagesChange);
- } else if (this.pageSelectorType === tf.fltTypeInp) {
- _Event.Event.remove(this.pagingSlc, 'keypress', evt._detectKey);
- }
- this.pagingSlc.parentNode.removeChild(this.pagingSlc);
- }
-
- if (btnNextSpan) {
- _Event.Event.remove(btnNextSpan, 'click', evt.next);
- btnNextSpan.parentNode.removeChild(btnNextSpan);
- }
-
- if (btnPrevSpan) {
- _Event.Event.remove(btnPrevSpan, 'click', evt.prev);
- btnPrevSpan.parentNode.removeChild(btnPrevSpan);
- }
-
- if (btnLastSpan) {
- _Event.Event.remove(btnLastSpan, 'click', evt.last);
- btnLastSpan.parentNode.removeChild(btnLastSpan);
- }
-
- if (btnFirstSpan) {
- _Event.Event.remove(btnFirstSpan, 'click', evt.first);
- btnFirstSpan.parentNode.removeChild(btnFirstSpan);
- }
-
- if (pgBeforeSpan) {
- pgBeforeSpan.parentNode.removeChild(pgBeforeSpan);
- }
-
- if (pgAfterSpan) {
- pgAfterSpan.parentNode.removeChild(pgAfterSpan);
- }
-
- if (pgspan) {
- pgspan.parentNode.removeChild(pgspan);
- }
-
- if (this.hasResultsPerPage) {
- this.removeResultsPerPage();
- }
-
- this.pagingSlc = null;
- this.nbPages = 0;
- this.isPagingRemoved = true;
- tf.paging = false;
- }
- }]);
-
- return Paging;
- })();
-
- exports.Paging = Paging;
-
-/***/ },
-/* 21 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _Event = __webpack_require__(2);
-
- var ClearButton = (function () {
-
- /**
- * Clear button component
- * @param {Object} tf TableFilter instance
- */
-
- function ClearButton(tf) {
- _classCallCheck(this, ClearButton);
-
- // Configuration object
- var f = tf.config();
-
- //id of container element
- this.btnResetTgtId = f.btn_reset_target_id || null;
- //reset button element
- this.btnResetEl = null;
- //defines reset text
- this.btnResetText = f.btn_reset_text || 'Reset';
- //defines reset button tooltip
- this.btnResetTooltip = f.btn_reset_tooltip || 'Clear filters';
- //defines reset button innerHtml
- this.btnResetHtml = f.btn_reset_html || (!tf.enableIcons ? null : ' ');
- //span containing reset button
- this.prfxResetSpan = 'resetspan_';
-
- this.tf = tf;
- }
-
- _createClass(ClearButton, [{
- key: 'onClick',
- value: function onClick() {
- this.tf.clearFilters();
- }
- }, {
- key: 'init',
-
- /**
- * Build DOM elements
- */
- value: function init() {
- var _this = this;
-
- var tf = this.tf;
-
- if (!tf.hasGrid() && !tf.isFirstLoad && tf.btnResetEl) {
- return;
- }
-
- var resetspan = _Dom.Dom.create('span', ['id', this.prfxResetSpan + tf.id]);
-
- // reset button is added to defined element
- if (!this.btnResetTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.btnResetTgtId ? tf.rDiv : _Dom.Dom.id(this.btnResetTgtId);
- targetEl.appendChild(resetspan);
-
- if (!this.btnResetHtml) {
- var fltreset = _Dom.Dom.create('a', ['href', 'javascript:void(0);']);
- fltreset.className = tf.btnResetCssClass;
- fltreset.appendChild(_Dom.Dom.text(this.btnResetText));
- resetspan.appendChild(fltreset);
- // fltreset.onclick = this.Evt._Clear;
- _Event.Event.add(fltreset, 'click', function () {
- _this.onClick();
- });
- } else {
- resetspan.innerHTML = this.btnResetHtml;
- var resetEl = resetspan.firstChild;
- // resetEl.onclick = this.Evt._Clear;
- _Event.Event.add(resetEl, 'click', function () {
- _this.onClick();
- });
- }
- this.btnResetEl = resetspan.firstChild;
- }
- }, {
- key: 'destroy',
-
- /**
- * Remove clear button UI
- */
- value: function destroy() {
- var tf = this.tf;
-
- if (!tf.hasGrid() || !this.btnResetEl) {
- return;
- }
-
- var resetspan = _Dom.Dom.id(tf.prfxResetSpan + tf.id);
- if (resetspan) {
- resetspan.parentNode.removeChild(resetspan);
- }
- this.btnResetEl = null;
- }
- }]);
-
- return ClearButton;
- })();
-
- exports.ClearButton = ClearButton;
-
-/***/ },
-/* 22 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _Event = __webpack_require__(2);
-
- var Help = (function () {
-
- /**
- * Help UI component
- * @param {Object} tf TableFilter instance
- */
-
- function Help(tf) {
- _classCallCheck(this, Help);
-
- // Configuration object
- var f = tf.config();
-
- //id of custom container element for instructions
- this.helpInstrTgtId = f.help_instructions_target_id || null;
- //id of custom container element for instructions
- this.helpInstrContTgtId = f.help_instructions_container_target_id || null;
- //defines help text
- this.helpInstrText = f.help_instructions_text ? f.help_instructions_text : 'Use the filters above each column to filter and limit table ' + 'data. Avanced searches can be performed by using the following ' + 'operators: < , <= , > , ' + '>= , = , * , ! , { , } , ' + '|| ,&& , [empty] , [nonempty] , ' + 'rgx: These operators are described here: ' + 'http://tablefilter.free.fr/#operators ';
- //defines help innerHtml
- this.helpInstrHtml = f.help_instructions_html || null;
- //defines reset button text
- this.helpInstrBtnText = f.help_instructions_btn_text || '?';
- //defines reset button innerHtml
- this.helpInstrBtnHtml = f.help_instructions_btn_html || null;
- //defines css class for help button
- this.helpInstrBtnCssClass = f.help_instructions_btn_css_class || 'helpBtn';
- //defines css class for help container
- this.helpInstrContCssClass = f.help_instructions_container_css_class || 'helpCont';
- //help button element
- this.helpInstrBtnEl = null;
- //help content div
- this.helpInstrContEl = null;
- this.helpInstrDefaultHtml = '';
-
- //id prefix for help elements
- this.prfxHelpSpan = 'helpSpan_';
- //id prefix for help elements
- this.prfxHelpDiv = 'helpDiv_';
-
- this.tf = tf;
- }
-
- _createClass(Help, [{
- key: 'init',
- value: function init() {
- var _this = this;
-
- if (this.helpInstrBtnEl) {
- return;
- }
-
- var tf = this.tf;
-
- var helpspan = _Dom.Dom.create('span', ['id', this.prfxHelpSpan + tf.id]);
- var helpdiv = _Dom.Dom.create('div', ['id', this.prfxHelpDiv + tf.id]);
-
- //help button is added to defined element
- if (!this.helpInstrTgtId) {
- tf.setToolbar();
- }
- var targetEl = !this.helpInstrTgtId ? tf.rDiv : _Dom.Dom.id(this.helpInstrTgtId);
- targetEl.appendChild(helpspan);
-
- var divContainer = !this.helpInstrContTgtId ? helpspan : _Dom.Dom.id(this.helpInstrContTgtId);
-
- if (!this.helpInstrBtnHtml) {
- divContainer.appendChild(helpdiv);
- var helplink = _Dom.Dom.create('a', ['href', 'javascript:void(0);']);
- helplink.className = this.helpInstrBtnCssClass;
- helplink.appendChild(_Dom.Dom.text(this.helpInstrBtnText));
- helpspan.appendChild(helplink);
- _Event.Event.add(helplink, 'click', function () {
- _this.toggle();
- });
- } else {
- helpspan.innerHTML = this.helpInstrBtnHtml;
- var helpEl = helpspan.firstChild;
- _Event.Event.add(helpEl, 'click', function () {
- _this.toggle();
- });
- divContainer.appendChild(helpdiv);
- }
-
- if (!this.helpInstrHtml) {
- helpdiv.innerHTML = this.helpInstrText;
- helpdiv.className = this.helpInstrContCssClass;
- _Event.Event.add(helpdiv, 'dblclick', function () {
- _this.toggle();
- });
- } else {
- if (this.helpInstrContTgtId) {
- divContainer.appendChild(helpdiv);
- }
- helpdiv.innerHTML = this.helpInstrHtml;
- if (!this.helpInstrContTgtId) {
- helpdiv.className = this.helpInstrContCssClass;
- _Event.Event.add(helpdiv, 'dblclick', function () {
- _this.toggle();
- });
- }
- }
- helpdiv.innerHTML += this.helpInstrDefaultHtml;
- _Event.Event.add(helpdiv, 'click', function () {
- _this.toggle();
- });
-
- this.helpInstrContEl = helpdiv;
- this.helpInstrBtnEl = helpspan;
- }
- }, {
- key: 'toggle',
-
- /**
- * Toggle help pop-up
- */
- value: function toggle() {
- if (!this.helpInstrContEl) {
- return;
- }
- var divDisplay = this.helpInstrContEl.style.display;
- if (divDisplay === '' || divDisplay === 'none') {
- this.helpInstrContEl.style.display = 'block';
- // TODO: use CSS instead for element positioning
- var btnLeft = _Dom.Dom.position(this.helpInstrBtnEl).left;
- if (!this.helpInstrContTgtId) {
- this.helpInstrContEl.style.left = btnLeft - this.helpInstrContEl.clientWidth + 25 + 'px';
- }
- } else {
- this.helpInstrContEl.style.display = 'none';
- }
- }
- }, {
- key: 'destroy',
-
- /**
- * Remove help UI
- */
- value: function destroy() {
- if (!this.helpInstrBtnEl) {
- return;
- }
- this.helpInstrBtnEl.parentNode.removeChild(this.helpInstrBtnEl);
- this.helpInstrBtnEl = null;
- if (!this.helpInstrContEl) {
- return;
- }
- this.helpInstrContEl.parentNode.removeChild(this.helpInstrContEl);
- this.helpInstrContEl = null;
- }
- }]);
-
- return Help;
- })();
-
- exports.Help = Help;
-
-/***/ },
-/* 23 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var AlternateRows = (function () {
-
- /**
- * Alternating rows color
- * @param {Object} tf TableFilter instance
- */
-
- function AlternateRows(tf) {
- _classCallCheck(this, AlternateRows);
-
- var f = tf.config();
- //defines css class for even rows
- this.evenCss = f.even_row_css_class || 'even';
- //defines css class for odd rows
- this.oddCss = f.odd_row_css_class || 'odd';
-
- this.tf = tf;
- }
-
- _createClass(AlternateRows, [{
- key: 'init',
-
- /**
- * Sets alternating rows color
- */
- value: function init() {
- if (!this.tf.hasGrid() && !this.tf.isFirstLoad) {
- return;
- }
- var rows = this.tf.tbl.rows;
- var noValidRowsIndex = this.tf.validRowsIndex === null;
- //1st index
- var beginIndex = noValidRowsIndex ? this.tf.refRow : 0;
- // nb indexes
- var indexLen = noValidRowsIndex ? this.tf.nbFilterableRows + beginIndex : this.tf.validRowsIndex.length;
- var idx = 0;
-
- //alternates bg color
- for (var j = beginIndex; j < indexLen; j++) {
- var rowIdx = noValidRowsIndex ? j : this.tf.validRowsIndex[j];
- this.setRowBg(rowIdx, idx);
- idx++;
- }
- }
- }, {
- key: 'setRowBg',
-
- /**
- * Sets row background color
- * @param {Number} rowIdx Row index
- * @param {Number} idx Valid rows collection index needed to calculate bg
- * color
- */
- value: function setRowBg(rowIdx, idx) {
- if (!this.tf.alternateBgs || isNaN(rowIdx)) {
- return;
- }
- var rows = this.tf.tbl.rows;
- var i = !idx ? rowIdx : idx;
- this.removeRowBg(rowIdx);
- _Dom.Dom.addClass(rows[rowIdx], i % 2 ? this.evenCss : this.oddCss);
- }
- }, {
- key: 'removeRowBg',
-
- /**
- * Removes row background color
- * @param {Number} idx Row index
- */
- value: function removeRowBg(idx) {
- if (isNaN(idx)) {
- return;
- }
- var rows = this.tf.tbl.rows;
- _Dom.Dom.removeClass(rows[idx], this.oddCss);
- _Dom.Dom.removeClass(rows[idx], this.evenCss);
- }
- }, {
- key: 'remove',
-
- /**
- * Removes all row background color
- */
- value: function remove() {
- if (!this.tf.hasGrid()) {
- return;
- }
- var row = this.tf.tbl.rows;
- for (var i = this.tf.refRow; i < this.tf.nbRows; i++) {
- this.removeRowBg(i);
- }
- this.tf.isStartBgAlternate = true;
- }
- }, {
- key: 'enable',
- value: function enable() {
- this.tf.alternateBgs = true;
- }
- }, {
- key: 'disable',
- value: function disable() {
- this.tf.alternateBgs = false;
- }
- }]);
-
- return AlternateRows;
- })();
-
- exports.AlternateRows = AlternateRows;
-
-/***/ },
-/* 24 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
-
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _Dom = __webpack_require__(3);
-
- var _Str = __webpack_require__(4);
-
- var _Types = __webpack_require__(6);
-
- var ColOps = (function () {
-
- /**
- * Column calculations
- * @param {Object} tf TableFilter instance
- */
-
- function ColOps(tf) {
- _classCallCheck(this, ColOps);
-
- var f = tf.config();
- this.colOperation = f.col_operation;
-
- //calls function before col operation
- this.onBeforeOperation = _Types.Types.isFn(f.on_before_operation) ? f.on_before_operation : null;
- //calls function after col operation
- this.onAfterOperation = _Types.Types.isFn(f.on_after_operation) ? f.on_after_operation : null;
-
- this.tf = tf;
- }
-
- _createClass(ColOps, [{
- key: 'calc',
-
- /**
- * Calculates columns' values
- * Configuration options are stored in 'colOperation' property
- * - 'id' contains ids of elements showing result (array)
- * - 'col' contains the columns' indexes (array)
- * - 'operation' contains operation type (array, values: 'sum', 'mean',
- * 'min', 'max', 'median', 'q1', 'q3')
- * - 'write_method' array defines which method to use for displaying the
- * result (innerHTML, setValue, createTextNode) - default: 'innerHTML'
- * - 'tot_row_index' defines in which row results are displayed
- * (integers array)
- *
- * - changes made by Nuovella:
- * (1) optimized the routine (now it will only process each column once),
- * (2) added calculations for the median, lower and upper quartile.
- */
- value: function calc() {
- if (!this.tf.isFirstLoad && !this.tf.hasGrid()) {
- return;
- }
-
- if (this.onBeforeOperation) {
- this.onBeforeOperation.call(null, this.tf);
- }
-
- var colOperation = this.colOperation,
- labelId = colOperation.id,
- colIndex = colOperation.col,
- operation = colOperation.operation,
- outputType = colOperation.write_method,
- totRowIndex = colOperation.tot_row_index,
- excludeRow = colOperation.exclude_row,
- decimalPrecision = colOperation.decimal_precision !== undefined ? colOperation.decimal_precision : 2;
-
- //nuovella: determine unique list of columns to operate on
- var ucolIndex = [],
- ucolMax = 0;
- ucolIndex[ucolMax] = colIndex[0];
-
- for (var ii = 1; ii < colIndex.length; ii++) {
- var saved = 0;
- //see if colIndex[ii] is already in the list of unique indexes
- for (var jj = 0; jj <= ucolMax; jj++) {
- if (ucolIndex[jj] === colIndex[ii]) {
- saved = 1;
- }
- }
- //if not saved then, save the index;
- if (saved === 0) {
- ucolMax++;
- ucolIndex[ucolMax] = colIndex[ii];
- }
- }
-
- if (_Str.Str.lower(typeof labelId) == 'object' && _Str.Str.lower(typeof colIndex) == 'object' && _Str.Str.lower(typeof operation) == 'object') {
- var row = this.tf.tbl.rows,
- colvalues = [];
-
- for (var ucol = 0; ucol <= ucolMax; ucol++) {
- //this retrieves col values
- //use ucolIndex because we only want to pass through this loop
- //once for each column get the values in this unique column
- colvalues.push(this.tf.getColValues(ucolIndex[ucol], true, excludeRow));
-
- //next: calculate all operations for this column
- var result,
- nbvalues = 0,
- temp,
- meanValue = 0,
- sumValue = 0,
- minValue = null,
- maxValue = null,
- q1Value = null,
- medValue = null,
- q3Value = null,
- meanFlag = 0,
- sumFlag = 0,
- minFlag = 0,
- maxFlag = 0,
- q1Flag = 0,
- medFlag = 0,
- q3Flag = 0,
- theList = [],
- opsThisCol = [],
- decThisCol = [],
- labThisCol = [],
- oTypeThisCol = [],
- mThisCol = -1;
-
- for (var k = 0; k < colIndex.length; k++) {
- if (colIndex[k] === ucolIndex[ucol]) {
- mThisCol++;
- opsThisCol[mThisCol] = _Str.Str.lower(operation[k]);
- decThisCol[mThisCol] = decimalPrecision[k];
- labThisCol[mThisCol] = labelId[k];
- oTypeThisCol = outputType !== undefined && _Str.Str.lower(typeof outputType) === 'object' ? outputType[k] : null;
-
- switch (opsThisCol[mThisCol]) {
- case 'mean':
- meanFlag = 1;
- break;
- case 'sum':
- sumFlag = 1;
- break;
- case 'min':
- minFlag = 1;
- break;
- case 'max':
- maxFlag = 1;
- break;
- case 'median':
- medFlag = 1;
- break;
- case 'q1':
- q1Flag = 1;
- break;
- case 'q3':
- q3Flag = 1;
- break;
- }
- }
- }
-
- for (var j = 0; j < colvalues[ucol].length; j++) {
- //sort the list for calculation of median and quartiles
- if (q1Flag == 1 || q3Flag == 1 || medFlag == 1) {
- if (j < colvalues[ucol].length - 1) {
- for (k = j + 1; k < colvalues[ucol].length; k++) {
- if (eval(colvalues[ucol][k]) < eval(colvalues[ucol][j])) {
- temp = colvalues[ucol][j];
- colvalues[ucol][j] = colvalues[ucol][k];
- colvalues[ucol][k] = temp;
- }
- }
- }
- }
- var cvalue = parseFloat(colvalues[ucol][j]);
- theList[j] = parseFloat(cvalue);
-
- if (!isNaN(cvalue)) {
- nbvalues++;
- if (sumFlag === 1 || meanFlag === 1) {
- sumValue += parseFloat(cvalue);
- }
- if (minFlag === 1) {
- if (minValue === null) {
- minValue = parseFloat(cvalue);
- } else {
- minValue = parseFloat(cvalue) < minValue ? parseFloat(cvalue) : minValue;
- }
- }
- if (maxFlag === 1) {
- if (maxValue === null) {
- maxValue = parseFloat(cvalue);
- } else {
- maxValue = parseFloat(cvalue) > maxValue ? parseFloat(cvalue) : maxValue;
- }
- }
- }
- } //for j
- if (meanFlag === 1) {
- meanValue = sumValue / nbvalues;
- }
- if (medFlag === 1) {
- var aux = 0;
- if (nbvalues % 2 === 1) {
- aux = Math.floor(nbvalues / 2);
- medValue = theList[aux];
- } else {
- medValue = (theList[nbvalues / 2] + theList[nbvalues / 2 - 1]) / 2;
- }
- }
- var posa;
- if (q1Flag === 1) {
- posa = 0;
- posa = Math.floor(nbvalues / 4);
- if (4 * posa == nbvalues) {
- q1Value = (theList[posa - 1] + theList[posa]) / 2;
- } else {
- q1Value = theList[posa];
- }
- }
- if (q3Flag === 1) {
- posa = 0;
- var posb = 0;
- posa = Math.floor(nbvalues / 4);
- if (4 * posa === nbvalues) {
- posb = 3 * posa;
- q3Value = (theList[posb] + theList[posb - 1]) / 2;
- } else {
- q3Value = theList[nbvalues - posa - 1];
- }
- }
-
- for (var i = 0; i <= mThisCol; i++) {
- switch (opsThisCol[i]) {
- case 'mean':
- result = meanValue;
- break;
- case 'sum':
- result = sumValue;
- break;
- case 'min':
- result = minValue;
- break;
- case 'max':
- result = maxValue;
- break;
- case 'median':
- result = medValue;
- break;
- case 'q1':
- result = q1Value;
- break;
- case 'q3':
- result = q3Value;
- break;
- }
-
- var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2;
-
- //if outputType is defined
- if (oTypeThisCol && result) {
- result = result.toFixed(precision);
-
- if (_Dom.Dom.id(labThisCol[i])) {
- switch (_Str.Str.lower(oTypeThisCol)) {
- case 'innerhtml':
- if (isNaN(result) || !isFinite(result) || nbvalues === 0) {
- _Dom.Dom.id(labThisCol[i]).innerHTML = '.';
- } else {
- _Dom.Dom.id(labThisCol[i]).innerHTML = result;
- }
- break;
- case 'setvalue':
- _Dom.Dom.id(labThisCol[i]).value = result;
- break;
- case 'createtextnode':
- var oldnode = _Dom.Dom.id(labThisCol[i]).firstChild;
- var txtnode = _Dom.Dom.text(result);
- _Dom.Dom.id(labThisCol[i]).replaceChild(txtnode, oldnode);
- break;
- } //switch
- }
- } else {
- try {
- if (isNaN(result) || !isFinite(result) || nbvalues === 0) {
- _Dom.Dom.id(labThisCol[i]).innerHTML = '.';
- } else {
- _Dom.Dom.id(labThisCol[i]).innerHTML = result.toFixed(precision);
- }
- } catch (e) {} //catch
- } //else
- } //for i
-
- // row(s) with result are always visible
- var totRow = totRowIndex && totRowIndex[ucol] ? row[totRowIndex[ucol]] : null;
- if (totRow) {
- totRow.style.display = '';
- }
- } //for ucol
- } //if typeof
-
- if (this.onAfterOperation) {
- this.onAfterOperation.call(null, this.tf);
- }
- }
- }]);
-
- return ColOps;
- })();
-
- exports.ColOps = ColOps;
-
-/***/ }
-/******/ ])
-});
-;
\ No newline at end of file
diff --git a/dist/tablefilter/1.js b/dist/tablefilter/1.js
new file mode 100644
index 00000000..b50d5dd3
--- /dev/null
+++ b/dist/tablefilter/1.js
@@ -0,0 +1,3 @@
+webpackJsonp([1],{1:function(t,e,s){function i(t){return s(n(t))}function n(t){return r[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var r={"./array":7,"./array.js":7,"./cookie":5,"./cookie.js":5,"./date":9,"./date.js":9,"./dom":3,"./dom.js":3,"./event":2,"./event.js":2,"./extensions/colsVisibility/colsVisibility":25,"./extensions/colsVisibility/colsVisibility.js":25,"./extensions/sort/adapterSortabletable":26,"./extensions/sort/adapterSortabletable.js":26,"./extensions/sort/sort":27,"./extensions/sort/sort.js":27,"./helpers":8,"./helpers.js":8,"./modules/alternateRows":23,"./modules/alternateRows.js":23,"./modules/checkList":17,"./modules/checkList.js":17,"./modules/clearButton":21,"./modules/clearButton.js":21,"./modules/colOps":24,"./modules/colOps.js":24,"./modules/dropdown":16,"./modules/dropdown.js":16,"./modules/gridLayout":12,"./modules/gridLayout.js":12,"./modules/help":22,"./modules/help.js":22,"./modules/highlightKeywords":14,"./modules/highlightKeywords.js":14,"./modules/loader":13,"./modules/loader.js":13,"./modules/paging":20,"./modules/paging.js":20,"./modules/popupFilter":15,"./modules/popupFilter.js":15,"./modules/rowsCounter":18,"./modules/rowsCounter.js":18,"./modules/statusBar":19,"./modules/statusBar.js":19,"./modules/store":11,"./modules/store.js":11,"./sort":10,"./sort.js":10,"./string":4,"./string.js":4,"./types":6,"./types.js":6};i.keys=function(){return Object.keys(r)},i.resolve=n,t.exports=i,i.id=1},25:function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n=function(){function t(t,e){for(var s=0;s0,this.onLoaded=l.Types.isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=l.Types.isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=l.Types.isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=l.Types.isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=l.Types.isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=l.Types.isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=l.Types.isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=l.Types.isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=l.Types.isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,e.gridLayout&&(this.headersTbl=e.Cpt.gridLayout.headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),e.includeFile(n.name+"Style",e.basePath+this.stylesheet,null,"link"),this.tf=e}return n(t,[{key:"toggle",value:function(t){var e=(this.tf,this.contEl.style.display),s=this.onBeforeOpen,i=this.onBeforeClose,n=this.onAfterOpen,r=this.onAfterClose;s&&"inline"!==e&&s.call(null,this),i&&"inline"===e&&i.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",n&&"inline"!==e&&n.call(null,this),r&&"inline"===e&&r.call(null,this)}},{key:"checkItem",value:function(t){var e=t.parentNode;if(e&&t){var s=t.firstChild.checked,i=t.firstChild.getAttribute("id").split("_")[1];i=parseInt(i,10),s?r.Dom.addClass(e,this.listSlcItemCssClass):r.Dom.removeClass(e,this.listSlcItemCssClass);var n=!1;(this.tickToHide&&s||!this.tickToHide&&!s)&&(n=!0),this.setHidden(i,n)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var t=this;if(!this.btnEl){var e=this.tf,s=r.Dom.create("span",["id",this.prfx+e.id]);s.className=this.spanCssClass,this.btnTgtId||e.setToolbar();var i=this.btnTgtId?r.Dom.id(this.btnTgtId):e.rDiv;if(this.btnTgtId)i.appendChild(s);else{var n=i.firstChild;n.parentNode.insertBefore(s,n)}if(this.btnHtml){s.innerHTML=this.btnHtml;var l=s.firstChild;this.enableHover?a.Event.add(l,"mouseover",function(e){t.toggle(e)}):a.Event.add(l,"click",function(e){t.toggle(e)})}else{var o=r.Dom.create("a",["href","javascript:;"]);o.className=this.btnCssClass,o.title=this.extDesc,o.innerHTML=this.btnText,s.appendChild(o),this.enableHover?a.Event.add(o,"mouseover",function(e){t.toggle(e)}):a.Event.add(o,"click",function(e){t.toggle(e)})}this.spanEl=s,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var t=this,e=this.tf,s=this.contElTgtId?r.Dom.id(this.contElTgtId):r.Dom.create("div",["id",this.prfxCont+e.id]);s.className=this.contCssClass;var i=r.Dom.create("p");i.innerHTML=this.text,s.appendChild(i);var n=r.Dom.create("ul",["id","ul"+this.extName+"_"+e.id]);n.className=this.listCssClass;var l=this.headersTbl?this.headersTbl:e.tbl,o=this.headersTbl?this.headersIndex:e.getHeadersRowIndex(),h=l.rows[o];if(this.enableTickAll){var d=r.Dom.createCheckItem("col__"+e.id,this.tickAllText,this.tickAllText);r.Dom.addClass(d,this.listItemCssClass),n.appendChild(d),d.check.checked=!this.tickToHide,a.Event.add(d.check,"click",function(t){for(var s=0;si.length;)i="0"+i;e[s]=i}return e.join(".")}function c(t,e){var s=d(t.value.toLowerCase()),i=d(e.value.toLowerCase());return s==i?0:i>s?-1:1}var p=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},u=function(){function t(t,e){for(var s=0;se;e++);return e},SortableTable.prototype.initHeader=function(s){var i=this;if(i.tHead){i.headersRow=e.headersRow;{var n=i.tHead.rows[i.headersRow].cells;i.tHead.ownerDocument||i.tHead.document}i.sortTypes=s||[];for(var r,l,a=n.length,o=0;a>o;o++)l=n[o],null!==i.sortTypes[o]&&"None"!==i.sortTypes[o]?(l.style.cursor="pointer",r=g.Dom.create("img",["src",t.sortImgPath+t.sortImgBlank]),l.appendChild(r),null!==i.sortTypes[o]&&l.setAttribute("_sortType",i.sortTypes[o]),m.Event.add(l,"click",i._headerOnclick)):(l.setAttribute("_sortType",s[o]),l._sortType="None");i.updateHeaderArrows()}},SortableTable.prototype.updateHeaderArrows=function(){var s,i,n,r=this;if(e.sortConfig.asyncSort&&null!==e.sortConfig.triggerIds){var l=e.sortConfig.triggerIds;s=[],i=l.length;for(var a=0;ao;o++){var h=s[o].getAttribute("_sortType");null!==h&&"None"!==h&&(n=s[o].lastChild||s[o],"img"!==n.nodeName.toLowerCase()&&(n=g.Dom.create("img",["src",t.sortImgPath+t.sortImgBlank]),s[o].appendChild(n)),o===r.sortColumn?n.className=t.sortImgClassName+" "+(this.descending?t.sortImgDescClassName:t.sortImgAscClassName):n.className=t.sortImgClassName)}},SortableTable.prototype.getRowValue=function(t,e,s){var i=this,n=i._sortTypeInfo[e];if(n&&n.getRowValue)return n.getRowValue(t,s);var r=t.cells[s],l=SortableTable.getInnerText(r);return i.getValueFromString(l,e)},SortableTable.getInnerText=function(e){return e?e.getAttribute(t.sortCustomKey)?e.getAttribute(t.sortCustomKey):g.Dom.getText(e):void 0}}},{key:"addSortType",value:function(){SortableTable.prototype.addSortType(arguments[0],arguments[1],arguments[2],arguments[3])}},{key:"setSortTypes",value:function(){for(var t=this,e=this.tf,s=e.sortConfig,r=s.sortTypes,p=[],u=0;u descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n';
+
+}});
\ No newline at end of file
diff --git a/dist/extensions/colsVisibility/colsVisibility.css b/dist/tablefilter/colsVisibility.css
similarity index 100%
rename from dist/extensions/colsVisibility/colsVisibility.css
rename to dist/tablefilter/colsVisibility.css
diff --git a/src/filtergrid.css b/dist/tablefilter/tablefilter.css
similarity index 83%
rename from src/filtergrid.css
rename to dist/tablefilter/tablefilter.css
index c0a8d3c1..d179752b 100644
--- a/src/filtergrid.css
+++ b/dist/tablefilter/tablefilter.css
@@ -1,6 +1,6 @@
/*====================================================
- HTML Table Filter Generator stylesheet
- - do not hesitate to edit classes below to
+ - do not hesitate to edit classes below to
change filter grid appearance
=====================================================*/
@@ -12,7 +12,7 @@ table.TF{
border-bottom:1px solid #ccc; border-right:1px solid #ccc;
}
table.TF th{
- background-color:#EBECEE;
+ background-color:#EBECEE;
border-bottom:1px solid #D0D0D0; border-right:1px solid #D0D0D0;
border-left:1px solid #fff; border-top:1px solid #fff;
padding:5px 5px 5px 5px; color:#333;
@@ -26,15 +26,15 @@ table.TF td{ padding:5px 5px 5px 5px; border-bottom:1px solid #D0D0D0; border-ri
height:20px;
background-color:#f4f4f4;
}
-.fltrow td, .fltrow th{ padding:2px !important; }
+.fltrow td, .fltrow th{ padding:2px !important; }
.btnflt{ /* button appearance */
font-size:11px; vertical-align:middle;
- margin:0 2px 0 2px; padding:0 1px 0 1px;
+ margin:0 2px 0 2px; padding:0 1px 0 1px;
}
.btnflt_icon{ /* button appearance when displayIcons is true */
width:19px; height:19px; cursor:pointer !important;
border:0 !important; vertical-align:middle;
- background:transparent url(TF_Themes/btn_filter.png) center center no-repeat !important;
+ background:transparent url(themes/btn_filter.png) center center no-repeat !important;
}
.flt{ /* filter (input) appearance */
background-color:#fff; font-size:10px;
@@ -42,11 +42,11 @@ table.TF td{ padding:5px 5px 5px 5px; border-bottom:1px solid #D0D0D0; border-ri
margin:0; width:97%; vertical-align:middle;
}
select.flt{ /* select filter */
- background-color:#fff; border:1px solid #ccc;
+ background-color:#fff; border:1px solid #ccc;
margin:0 1px 1px 0; width:99%; font-size:9px; vertical-align:middle;
}
select.flt_multi{ /* multiple select filter */
- background-color:#fff; border:1px solid #ccc;
+ background-color:#fff; border:1px solid #ccc;
margin:0 1px 1px 0; width:99%; height:100px;
font-size:9px; vertical-align:middle;
}
@@ -95,42 +95,42 @@ select.flt_multi{ /* multiple select filter */
input.reset{
width:19px; height:19px; cursor:pointer !important;
border:0 !important; vertical-align:middle;
- background:transparent url(TF_Themes/btn_clear_filters.png) center center no-repeat !important;
+ background:transparent url(themes/btn_clear_filters.png) center center no-repeat !important;
}
-input.reset:hover{ background:#CAD1D6 url(TF_Themes/btn_clear_filters.png) center center no-repeat !important; }
+input.reset:hover{ background:#CAD1D6 url(themes/btn_clear_filters.png) center center no-repeat !important; }
/* PAGING ELEMENTS
=====================================================*/
.inf{ /* div containing left, middle and right divs */
- clear:both; width:auto; height:25px;
- background:#f4f4f4; font-size:12px;
- margin:0; padding:1px 3px 1px 3px;
+ clear:both; width:auto; height:25px;
+ background:#f4f4f4; font-size:12px;
+ margin:0; padding:1px 3px 1px 3px;
border:1px solid #ccc; overflow:hidden;
}
.ldiv{ /* left div */
- float:left; width:30%; position:inherit;
+ float:left; width:30%; position:inherit;
}
.mdiv{ /* middle div */
float:left; width:38%; position:inherit; text-align:center;
padding:1px 0;
}
.rdiv{ /* right div */
- float:right; width:30%; position:inherit; text-align:right;
+ float:right; width:30%; position:inherit; text-align:right;
}
select.pgSlc{ height:20px; vertical-align:middle; font-size:10px; }/*paging drop-down list*/
-input.pgNbInp{/*paging text-box*/
+input.pgNbInp{/*paging text-box*/
width:25px; height:16px; margin:1px;
- font-size:11px; vertical-align:middle;
+ font-size:11px; vertical-align:middle;
}
input.pgInp{ /*paging buttons (Next/Previous)*/
vertical-align: middle;
width:19px; height:19px; cursor:pointer !important;
border:0 !important; font-weight:bold; font-size:11px;
}
-.nextPage{ background:transparent url(TF_Themes/btn_next_page.gif) center center no-repeat !important; }
-.previousPage{ background:transparent url(TF_Themes/btn_previous_page.gif) center center no-repeat !important; }
-.firstPage{ background:transparent url(TF_Themes/btn_first_page.gif) center center no-repeat !important; }
-.lastPage{ background:transparent url(TF_Themes/btn_last_page.gif) center center no-repeat !important; }
+.nextPage{ background:transparent url(themes/btn_next_page.gif) center center no-repeat !important; }
+.previousPage{ background:transparent url(themes/btn_previous_page.gif) center center no-repeat !important; }
+.firstPage{ background:transparent url(themes/btn_first_page.gif) center center no-repeat !important; }
+.lastPage{ background:transparent url(themes/btn_last_page.gif) center center no-repeat !important; }
.nextPage:hover, .previousPage:hover, .firstPage:hover, .lastPage:hover{ background-color:#CAD1D6 !important; }
span.nbpg{ padding:0 5px 0 0; }/*paging nb pages*/
@@ -157,9 +157,9 @@ span.keyword{ background-color: #ffcc00;}/*highlighted word*/
.loader{ /* loader appearance */
position:absolute; padding: 5px 10px 5px 10px;
- margin:20px 0 0 20px; width:auto;
+ margin:20px 0 0 20px; width:auto;
z-index:1000; font-size:12px; font-weight:bold;
- border:1px solid #666; background:#f4f4f4;
+ border:1px solid #666; background:#f4f4f4;
vertical-align:middle;
}
@@ -180,11 +180,11 @@ div.head{ width:auto; overflow:hidden; }
/* Help elements */
.helpBtn{ margin:0 5px 0 5px; padding: 2px 4px 2px 4px; border-left:1px solid #ccc; border-right:1px solid #ccc; } /* help button */
div.helpCont{ /* help container */
- position:absolute; display:none;
+ position:absolute; display:none;
max-width:300px; overflow:auto;
padding:7px 7px 7px 7px; margin:15px 0;
- border:1px solid #CCC; line-height:19px;
- font-size:12px; color:#333;
+ border:1px solid #CCC; line-height:19px;
+ font-size:12px; color:#333;
background:#fff; text-align:left;
border-radius:4px;
-moz-border-radius:4px;
@@ -200,10 +200,10 @@ div.helpFooter{ margin:10px 0 0 0; }
div.helpFooter h4{ margin:2px 2px 2px 2px; font-size:13px; color:#333; }
/* Pop-up filters elements */
-div.popUpFilter{
+div.popUpFilter{
position:absolute; display:none; width:100px;
background:#C8E0FB; border:1px solid #e4e4e4;
- padding:1px 3px 1px 1px;
+ padding:1px 3px 1px 1px;
margin:20px auto 0 0px;
}
@@ -215,8 +215,8 @@ div.popUpFilter{
div.grd_Cont{ /*Main container*/
width:800px; height:auto;
overflow:hidden;
- padding:3px 3px 3px 3px;
- background:#C8E0FB;
+ padding:3px 3px 3px 3px;
+ background:#C8E0FB;
border:1px solid #99BBE8;
}
div.grd_tblCont{ /*Content table container*/
@@ -252,7 +252,7 @@ div.grd_tblCont table th, div.grd_headTblCont table th, div.grd_headTblCont tabl
text-overflow:ellipsis;
}
div.grd_tblCont table td{
- padding:2px 2px 2px 2px !important;
+ padding:2px 2px 2px 2px !important;
border-bottom:1px solid #ccc !important;
overflow:hidden;
/*white-space:nowrap;*/
@@ -260,8 +260,8 @@ div.grd_tblCont table td{
}
.grd_inf{ /* div containing left, middle and right divs */
- clear:both; width:auto; height:25px;
- background:#C8E0FB; font-size:11px;
+ clear:both; width:auto; height:25px;
+ background:#C8E0FB; font-size:11px;
margin:0; padding:1px 3px 1px 3px;
border-top:1px solid #99BBE8;
}
@@ -277,7 +277,7 @@ div.grd_Cont .odd{ background-color:#DFE8F6; }/*row bg alternating color*/
.ezSelectedRow{ background-color:#316AC5; color:#fff; }
.ezActiveCell{
background-color:#D9E8FB !important;
- color:#000 !important; font-weight:bold;
+ color:#000 !important; font-weight:bold;
}
.ezETSelectedCell{ background-color:#FFDC61 !important; font-weight:bold; color:rgb(0,0,0)!important; }
.ezUnselectable{
@@ -296,7 +296,7 @@ div.grd_Cont .odd{ background-color:#DFE8F6; }/*row bg alternating color*/
select[multiple="multiple"].ezSelectEditor{ height:35px; }
/* Command type editor */
.ezCommandEditor{ margin:2px; }
-.ezCommandEditor button, .ezCommandEditor input[type="button"] {
+.ezCommandEditor button, .ezCommandEditor input[type="button"] {
font-size:11px; min-height:22px;
margin:1px; padding:3px;
border:1px solid #ccc; background:#fff;
@@ -324,5 +324,5 @@ select[multiple="multiple"].ezSelectEditor{ height:35px; }
background-position:center center;
background-repeat:no-repeat;
}
-.sort-arrow.descending{ background-image:url("TF_Themes/downsimple.png"); }
-.sort-arrow.ascending{ background-image:url("TF_Themes/upsimple.png"); }
\ No newline at end of file
+.sort-arrow.descending{ background-image:url("themes/downsimple.png"); }
+.sort-arrow.ascending{ background-image:url("themes/upsimple.png"); }
\ No newline at end of file
diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js
new file mode 100644
index 00000000..64e68d6e
--- /dev/null
+++ b/dist/tablefilter/tablefilter.js
@@ -0,0 +1,7 @@
+!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}}(this,function(){return function(t){function e(s){if(i[s])return i[s].exports;var l=i[s]={exports:{},id:s,loaded:!1};return t[s].call(l.exports,l,l.exports,e),l.loaded=!0,l.exports}var s=window.webpackJsonp;window.webpackJsonp=function(i,a){for(var r,n,o=0,h=[];o1)for(var s=0;s1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==n.filters_cell_tag||"td"!==n.filters_cell_tag?"td":n.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.tblData=[],this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.contDiv=null,this.infDivCssClass=n.inf_div_css_class||"inf",this.lDivCssClass=n.left_div_css_class||"ldiv",this.rDivCssClass=n.right_div_css_class||"rdiv",this.mDivCssClass=n.middle_div_css_class||"mdiv",this.contDivCssClass=n.content_div_css_class||"cont",this.stylesheet=n.stylesheet||this.basePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=n.flts_row_css_class||"fltrow",this.enableIcons=n.enable_icons===!1?!1:!0,this.alternateBgs=n.alternate_rows===!0?!0:!1,this.hasColWidth=n.col_width===!0?!0:!1,this.colWidth=this.hasColWidth?n.col_width:null,this.fixedHeaders=n.fixed_headers===!0?!0:!1,this.tBodyH=isNaN(n.tbody_height)?200:n.tbody_height,this.fltCssClass=n.flt_css_class||"flt",this.fltMultiCssClass=n.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=n.flt_small_css_class||"flt_s",this.singleFltCssClass=n.single_flt_css_class||"single_flt",this.isStartBgAlternate=!0,this.enterKey=n.enter_key===!1?!1:!0,this.isModFilterFn=n.mod_filter_fn===!0?!0:!1,this.modFilterFn=this.isModFilterFn?n.mod_filter_fn:null,this.onBeforeFilter=c.Types.isFn(n.on_before_filter)?n.on_before_filter:null,this.onAfterFilter=c.Types.isFn(n.on_after_filter)?n.on_after_filter:null,this.matchCase=n.match_case===!0?!0:!1,this.exactMatch=n.exact_match===!0?!0:!1,this.linkedFilters=n.linked_filters===!0?!0:!1,this.disableExcludedOptions=n.disable_excluded_options===!0?!0:!1,this.activeFlt=null,this.activeFilterId=null,this.hasColOperation=n.col_operation?!0:!1,this.colOperation=null,this.hasVisibleRows=n.rows_always_visible?!0:!1,this.visibleRows=this.hasVisibleRows?n.rows_always_visible:[],this.searchType=n.search_type||"include",this.isExternalFlt=n.external_flt_grid===!0?!0:!1,this.externalFltTgtIds=n.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(n.exec_delay)?100:parseInt(n.exec_delay,10),this.onFiltersLoaded=c.Types.isFn(n.on_filters_loaded)?n.on_filters_loaded:null,this.singleSearchFlt=n.single_search_filter===!0?!0:!1,this.onRowValidated=c.Types.isFn(n.on_row_validated)?n.on_row_validated:null,this.customCellDataCols=n.custom_cell_data_cols?n.custom_cell_data_cols:[],this.customCellData=c.Types.isFn(n.custom_cell_data)?n.custom_cell_data:null,this.watermark=n.watermark||"",this.isWatermarkArray=c.Types.isArray(this.watermark),this.toolBarTgtId=n.toolbar_target_id||null,this.helpInstructions=n.help_instructions||!1,this.popUpFilters=n.popup_filters===!0?!0:!1,this.markActiveColumns=n.mark_active_columns===!0?!0:!1,this.activeColumnsCssClass=n.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=c.Types.isFn(n.on_before_active_column)?n.on_before_active_column:null,this.onAfterActiveColumn=c.Types.isFn(n.on_after_active_column)?n.on_after_active_column:null,this.displayAllText=n.display_all_text||"",this.enableEmptyOption=n.enable_empty_option===!0?!0:!1,this.emptyText=n.empty_text||"(Empty)",this.enableNonEmptyOption=n.enable_non_empty_option===!0?!0:!1,this.nonEmptyText=n.non_empty_text||"(Non empty)",this.onSlcChange=n.on_change===!1?!1:!0,this.sortSlc=n.sort_select===!1?!1:!0,this.isSortNumAsc=n.sort_num_asc===!0?!0:!1,this.sortNumAsc=this.isSortNumAsc?n.sort_num_asc:null,this.isSortNumDesc=n.sort_num_desc===!0?!0:!1,this.sortNumDesc=this.isSortNumDesc?n.sort_num_desc:null,this.fillSlcOnDemand=n.fill_slc_on_demand===!0?!0:!1,this.hasCustomSlcOptions=c.Types.isObj(n.custom_slc_options)?!0:!1,this.customSlcOptions=c.Types.isArray(n.custom_slc_options)?n.custom_slc_options:null,this.rgxOperator=n.regexp_operator||"rgx:",this.emOperator=n.empty_operator||"[empty]",this.nmOperator=n.nonempty_operator||"[nonempty]",this.orOperator=n.or_operator||"||",this.anOperator=n.and_operator||"&&",this.grOperator=n.greater_operator||">",this.lwOperator=n.lower_operator||"<",this.leOperator=n.lower_equal_operator||"<=",this.geOperator=n.greater_equal_operator||">=",this.dfOperator=n.different_operator||"!",this.lkOperator=n.like_operator||"*",this.eqOperator=n.equal_operator||"=",this.stOperator=n.start_with_operator||"{",this.enOperator=n.end_with_operator||"}",this.curExp=n.cur_exp||"^[¥£€$]",this.separator=n.separator||",",this.rowsCounter=n.rows_counter===!0?!0:!1,this.statusBar=n.status_bar===!0?!0:!1,this.loader=n.loader===!0?!0:!1,this.displayBtn=n.btn===!0?!0:!1,this.btnText=n.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=n.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=n.btn_reset===!0?!0:!1,this.btnResetCssClass=n.btn_reset_css_class||"reset",this.onBeforeReset=c.Types.isFn(n.on_before_reset)?n.on_before_reset:null,this.onAfterReset=c.Types.isFn(n.on_after_reset)?n.on_after_reset:null,this.paging=n.paging===!0?!0:!1,this.nbVisibleRows=0,this.nbHiddenRows=0,this.sort=n.sort===!0?!0:!1,this.isSortEnabled=!1,this.sortConfig=n.sort_config||{},this.sortConfig.name=void 0!==this.sortConfig.name?n.sort_config.name:"sortabletable",this.sortConfig.src=void 0!==this.sortConfig.src?n.sort_config.src:this.extensionsPath+"sort/sortabletable.js",this.sortConfig.adapterSrc=void 0!==this.sortConfig.adapter_src?n.sort_config.adapter_src:this.extensionsPath+"sort/adapterSortabletable.js",this.sortConfig.initialize=void 0!==this.sortConfig.initialize?n.sort_config.initialize:function(t){},this.sortConfig.sortTypes=c.Types.isArray(this.sortConfig.sort_types)?n.sort_config.sort_types:[],this.sortConfig.sortCol=void 0!==this.sortConfig.sort_col?n.sort_config.sort_col:null,this.sortConfig.asyncSort=this.sortConfig.async_sort===!0?!0:!1,this.sortConfig.triggerIds=c.Types.isArray(this.sortConfig.sort_trigger_ids)?n.sort_config.sort_trigger_ids:[],this.selectable=n.selectable===!0?!0:!1,this.editable=n.editable===!0?!0:!1,this.ezEditTableConfig=n.ezEditTable_config||{},this.ezEditTableConfig.name=void 0!==this.ezEditTableConfig.name?n.ezEditTable_config.name:"ezedittable",this.ezEditTableConfig.src=void 0!==this.ezEditTableConfig.src?n.ezEditTable_config.src:this.extensionsPath+"ezEditTable/ezEditTable.js",this.ezEditTableConfig.loadStylesheet=this.ezEditTableConfig.loadStylesheet===!0?!0:!1,this.ezEditTableConfig.stylesheet=this.ezEditTableConfig.stylesheet||this.extensionsPath+"ezEditTable/ezEditTable.css",this.ezEditTableConfig.stylesheetName=void 0!==this.ezEditTableConfig.stylesheetName?n.ezEditTable_config.stylesheetName:"ezEditTableCss",this.ezEditTableConfig.err='Failed to instantiate EditTable object.\n"ezEditTable" module may not be available.',this.onKeyUp=n.on_keyup===!0?!0:!1,this.onKeyUpDelay=isNaN(n.on_keyup_delay)?900:n.on_keyup_delay,this.isUserTyping=null,this.onKeyUpTimer=void 0,this.highlightKeywords=n.highlight_keywords===!0?!0:!1,this.defaultDateType=n.default_date_type||"DMY",this.thousandsSeparator=n.thousands_separator||",",this.decimalSeparator=n.decimal_separator||".",this.hasColNbFormat=n.col_number_format===!0?!0:!1,this.colNbFormat=c.Types.isArray(this.hasColNbFormat)?n.col_number_format:null,this.hasColDateType=n.col_date_type===!0?!0:!1,this.colDateType=c.Types.isArray(this.hasColDateType)?n.col_date_type:null,this.msgFilter=n.msg_filter||"Filtering data...",this.msgPopulate=n.msg_populate||"Populating filter...",this.msgPopulateCheckList=n.msg_populate_checklist||"Populating list...",this.msgChangePage=n.msg_change_page||"Collecting paging data...",this.msgClear=n.msg_clear||"Clearing filters...",this.msgChangeResults=n.msg_change_results||"Changing results per page...",this.msgResetValues=n.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=n.msg_reset_page||"Re-setting page...",this.msgResetPageLength=n.msg_reset_page_length||"Re-setting page length...",this.msgSort=n.msg_sort||"Sorting data...",this.msgLoadExtensions=n.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=n.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=n.remember_grid_values===!0?!0:!1,this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&n.remember_page_number?!0:!1,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&n.remember_page_length?!0:!1,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=n.extensions,this.hasExtensions=c.Types.isArray(this.extensions),this.enableDefaultTheme=n.enable_default_theme===!0?!0:!1,this.hasThemes=n.enable_default_theme||n.themes&&c.Types.isObj(n.themes)?!0:!1,this.themes=this.hasThemes?n.themes:null,this.themesPath=n.themes_path||this.basePath+"themes/",this.Cpt={loader:null,alternateRows:null,colOps:null,rowsCounter:null,gridLayout:null,store:null,highlightKeywords:null,paging:null,checkList:null,dropdown:null,popupFilter:null,clearButton:null,help:null,statusBar:null},this.ExtRegistry={sort:null,ezEditTable:null};var g=this;this.Evt={name:{filter:"Filter",dropdown:"dropdown",checklist:"checkList",changepage:"changePage",clear:"Clear",changeresultsperpage:"changeResults",resetvalues:"ResetValues",resetpage:"resetPage",resetpagelength:"resetPageLength",sort:"Sort",loadextensions:"LoadExtensions",loadthemes:"loadThemes"},detectKey:function(t){if(g.enterKey){var e=t||D.event;if(e){var s=e.Event.keyCode(e);13===s?(g._filter(),e.Event.cancel(e),e.Event.stop(e)):(g.isUserTyping=!0,D.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0)}}},onKeyUp:function(t){function e(){D.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0,g.isUserTyping||(g.filter(),g.isUserTyping=null)}if(g.onKeyUp){var s=t||D.event,i=s.Event.keyCode(s);g.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?void 0===g.onKeyUpTimer&&(g.onKeyUpTimer=D.setInterval(e,g.onKeyUpDelay)):(D.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0)}},onKeyDown:function(t){g.onKeyUp&&(g.isUserTyping=!0)},onInpBlur:function(t){g.onKeyUp&&(g.isUserTyping=!1,D.clearInterval(g.onKeyUpTimer)),g.ezEditTable&&(g.editable&&g.ezEditTable.Editable.Set(),g.selectable&&g.ezEditTable.Selection.Set())},onInpFocus:function(t){var e=t||D.event;g.activeFilterId=this.getAttribute("id"),g.activeFlt=h.Dom.id(g.activeFilterId),g.popUpFilters&&(e.Event.cancel(e),e.Event.stop(e)),g.ezEditTable&&(g.editable&&g.ezEditTable.Editable.Remove(),g.selectable&&g.ezEditTable.Selection.Remove())},onSlcFocus:function(t){var e=t||D.event;if(g.activeFilterId=this.getAttribute("id"),g.activeFlt=h.Dom.id(g.activeFilterId),g.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var s=this.getAttribute("ct");g.Cpt.dropdown._build(s)}g.popUpFilters&&(e.Event.cancel(e),e.Event.stop(e))},onSlcChange:function(t){if(g.activeFlt){var e=(g.activeFlt.getAttribute("colIndex"),t||D.event);g.popUpFilters&&e.Event.stop(e),g.onSlcChange&&g.filter()}},onCheckListClick:function(){if(g.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var t=this.getAttribute("ct");g.Cpt.checkList._build(t),g.Cpt.checkList.checkListDiv[t].onclick=null,g.Cpt.checkList.checkListDiv[t].title=""}},onCheckListFocus:function(t){g.activeFilterId=this.firstChild.getAttribute("id"),g.activeFlt=h.Dom.id(g.activeFilterId)},onBtnClick:function(){g.filter()}}}}return n(t,[{key:"init",value:function(){if(!this._hasGrid){this.tbl||(this.tbl=h.Dom.id(this.id)),this.gridLayout&&(this.refRow=null===this.startRow?0:this.startRow),this.popUpFilters&&(0===this.filtersRowIndex&&1===this.headersRow||this.gridLayout)&&(this.headersRow=0);var t,e=this.cfg,s=this.singleSearchFlt?1:this.nbCells;if(void 0===window["tf_"+this.id]&&(window["tf_"+this.id]=this),this.includeFile(this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(this.Cpt.store=new g.Store(this)),this.gridLayout&&(this.Cpt.gridLayout=new v.GridLayout(this),this.Cpt.gridLayout.init()),this.loader&&(this.Cpt.loader||(this.Cpt.loader=new m.Loader(this))),this.highlightKeywords&&(this.Cpt.highlightKeyword=new b.HighlightKeyword(this)),this.popUpFilters&&(this.Cpt.popupFilter||(this.Cpt.popupFilter=new C.PopupFilter(this)),this.Cpt.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var i;if(!this.gridLayout){var l=h.Dom.tag(this.tbl,"thead");i=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popUpFilters&&this.headersRow++,this.popUpFilters&&this.headersRow++,i.className=this.fltsRowCssClass,!this.isExternalFlt||this.gridLayout&&!this.popUpFilters||(i.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var a=0;s>a;a++){this.popUpFilters&&this.Cpt.popupFilter.build(a);var r=h.Dom.create(this.fltCellTag),n=this["col"+a],d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[a]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||i.appendChild(r),t=a==s-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,void 0===n&&(n=void 0===e["col_"+a]?this.fltTypeInp:p.Str.lower(e["col_"+a])),this.singleSearchFlt&&(n=this.fltTypeInp,t=this.singleFltCssClass),n===this.fltTypeSlc||n===this.fltTypeMulti){this.Cpt.dropdown||(this.Cpt.dropdown=new _.Dropdown(this));var c=this.Cpt.dropdown,u=h.Dom.create(this.fltTypeSlc,["id",this.prfxFlt+a+"_"+this.id],["ct",a],["filled","0"]);if(n===this.fltTypeMulti&&(u.multiple=this.fltTypeMulti,u.title=c.multipleSlcTooltip),u.className=p.Str.lower(n)===this.fltTypeSlc?t:this.fltMultiCssClass,d?(h.Dom.id(d).appendChild(u),this.externalFltEls.push(u)):r.appendChild(u),this.fltIds.push(this.prfxFlt+a+"_"+this.id),this.fillSlcOnDemand||c._build(a),o.Event.add(u,"keypress",this.Evt.detectKey),o.Event.add(u,"change",this.Evt.onSlcChange),o.Event.add(u,"focus",this.Evt.onSlcFocus),this.fillSlcOnDemand){var f=h.Dom.createOpt(this.displayAllText,"");u.appendChild(f)}}else if(n===this.fltTypeCheckList){var D;this.Cpt.checkList||(this.Cpt.checkList=new y.CheckList(this),D=this.Cpt.checkList);var F=h.Dom.create("div",["id",D.prfxCheckListDiv+a+"_"+this.id],["ct",a],["filled","0"]);F.className=D.checkListDivCssClass,d?(h.Dom.id(d).appendChild(F),this.externalFltEls.push(F)):r.appendChild(F),D.checkListDiv[a]=F,this.fltIds.push(this.prfxFlt+a+"_"+this.id),this.fillSlcOnDemand||D._build(a),this.fillSlcOnDemand&&(o.Event.add(F,"click",this.Evt.onCheckListClick),F.appendChild(h.Dom.text(D.activateCheckListTxt))),o.Event.add(F,"click",this.Evt.onCheckListFocus)}else{var E=n===this.fltTypeInp?"text":"hidden",P=h.Dom.create(this.fltTypeInp,["id",this.prfxFlt+a+"_"+this.id],["type",E],["ct",a]);if("hidden"!==E&&this.watermark&&P.setAttribute("placeholder",this.isWatermarkArray?this.watermark[a]||"":this.watermark),P.className=t,P.onfocus=this.Evt.onInpFocus,d?(h.Dom.id(d).appendChild(P),this.externalFltEls.push(P)):r.appendChild(P),this.fltIds.push(this.prfxFlt+a+"_"+this.id),P.onkeypress=this.Evt.detectKey,P.onkeydown=this.Evt.onKeyDown,P.onkeyup=this.Evt.onKeyUp,P.onblur=this.Evt.onInpBlur,this.rememberGridValues){var L=this.Cpt.store.getFilterValues(this.fltsValuesCookie);" "!=L[a]&&this.setFilterValue(a,L[a],!1)}}if(a==s-1&&this.displayBtn){var N=h.Dom.create(this.fltTypeInp,["id",this.prfxValButton+a+"_"+this.id],["type","button"],["value",this.btnText]);N.className=this.btnCssClass,d?h.Dom.id(d).appendChild(N):r.appendChild(N),N.onclick=this.Evt.onBtnClick}}}else this._resetGrid();else this.refRow=this.refRow-1,this.gridLayout&&(this.refRow=0),this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow;this.rowsCounter&&(this.Cpt.rowsCounter=new w.RowsCounter(this),this.Cpt.rowsCounter.init()),this.statusBar&&(this.Cpt.statusBar=new x.StatusBar(this),this.Cpt.statusBar.init()),(this.paging||this.Cpt.paging&&this.Cpt.paging.isPagingRemoved)&&(this.Cpt.paging=new T.Paging(this),this.Cpt.paging.init()),this.btnReset&&(this.Cpt.clearButton=new k.ClearButton(this),this.Cpt.clearButton.init()),this.helpInstructions&&(this.Cpt.help=new I.Help(this),this.Cpt.help.init()),this.hasColWidth&&!this.gridLayout&&this.setColWidths(),this.alternateBgs&&(this.Cpt.alternateRows=new R.AlternateRows(this),this.Cpt.alternateRows.init()),this.hasColOperation&&(this.Cpt.colOps=new S.ColOps(this),this.Cpt.colOps.calc()),this.sort&&this.setSort(),(this.selectable||this.editable)&&this.setEditable(),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||h.Dom.addClass(this.tbl,this.prfxTf),this.loader&&this.Cpt.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this)}}},{key:"EvtManager",value:function(t,e){function s(){if(t){switch(t){case i.Evt.name.filter:i.isModFilterFn?i.modFilterFn.call(null,i):i._filter();break;case i.Evt.name.dropdown:i.linkedFilters?i.Cpt.dropdown._build(l,!0):i.Cpt.dropdown._build(l,!1,a,r);break;case i.Evt.name.checklist:i.Cpt.checkList._build(l,a,r);break;case i.Evt.name.changepage:i.Cpt.paging._changePage(n);break;case i.Evt.name.clear:i._clearFilters(),i._filter();break;case i.Evt.name.changeresultsperpage:i.Cpt.paging._changeResultsPerPage();break;case i.Evt.name.resetvalues:i._resetValues(),i._filter();break;case i.Evt.name.resetpage:i.Cpt.paging._resetPage(i.pgNbCookie);break;case i.Evt.name.resetpagelength:i.Cpt.paging._resetPageLength(i.pgLenCookie);break;case i.Evt.name.sort:break;case i.Evt.name.loadextensions:i._loadExtensions();break;case i.Evt.name.loadthemes:i._loadThemes();break;default:i["_"+t].call(null,i,e)}i.statusBar&&i.Cpt.statusBar.message(""),i.loader&&i.Cpt.loader.show("none")}}var i=this,l=e&&void 0!==e.slcIndex?e.slcIndex:null,a=e&&void 0!==e.slcExternal?e.slcExternal:!1,r=e&&void 0!==e.slcId?e.slcId:null,n=e&&void 0!==e.pgIndex?e.pgIndex:null;if(this.loader||this.statusBar){try{this.Cpt.loader.show(""),this.Cpt.statusBar.message(this["msg"+t])}catch(o){}D.setTimeout(s,this.execDelay)}else s()}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0;e ',this.btnPrevPageHtml=' ',this.btnNextPageHtml=' ',this.btnFirstPageHtml=' ',this.btnLastPageHtml=' ',this.loader=!0,this.loaderHtml='
',this.loaderText=null}}},{key:"remove",value:function(){if(this.fltGrid&&this._hasGrid){var t=this.tbl.rows;this.paging&&this.Cpt.paging.destroy(),this.statusBar&&this.Cpt.statusBar.destroy(),this.rowsCounter&&this.Cpt.rowsCounter.destroy(),this.btnReset&&this.Cpt.clearButton.destroy(),this.helpInstructions&&this.Cpt.help.destroy(),this.isExternalFlt&&!this.popUpFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&this.Cpt.highlightKeyword.unhighlightAll(),this.sort&&this.ExtRegistry.sort.destroy(),this.loader&&this.Cpt.loader.remove(),this.popUpFilters&&this.Cpt.popupFilter.destroy(),this.markActiveColumns&&this.clearActiveColumns(),(this.editable||this.selectable)&&this.removeEditable();for(var e=this.refRow;e0&&!s.startRow?void 0:s.startRow||t.refRow,s.scroll_into_view=s.scroll_into_view===!1?!1:!0,s.base_path=s.base_path||t.basePath+"ezEditTable/",s.editable=t.editable=t.cfg.editable,s.selection=t.selectable=t.cfg.selectable,t.selectable&&(s.default_selection=s.default_selection||"row"),s.active_cell_css=s.active_cell_css||"ezETSelectedCell",t._lastValidRowIndex=0,t._lastRowIndex=0,t.selectable){var l=function(e,s,i){var l=e.Selection,a=function(i){if("row"===e.defaultSelection)l.SelectRowByIndex(i);else{e.ClearSelections();var a=s.cellIndex,r=t.tbl.rows[i];"both"===e.defaultSelection&&l.SelectRowByIndex(i),r&&l.SelectCell(r.cells[a])}if(t.validRowsIndex.length!==t.getRowsNb()){var n=t.tbl.rows[i];n&&n.scrollIntoView(!1),p&&(p.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===p.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:p.scrollIntoView(!1))}};if(t.validRowsIndex){var r,n=t.validRowsIndex,o=n.length,h="row"!==e.defaultSelection?s.parentNode:s,p="TD"===s.nodeName?s:null,d=void 0!==i?e.Event.GetKey(i):0,c=u.Arr.has(n,h.rowIndex),f=34===d||33===d?t.pagingLength||e.nbRowsPerPage:1;if(c)34!==d&&33!==d?(t._lastValidRowIndex=u.Arr.indexByValue(n,h.rowIndex),t._lastRowIndex=h.rowIndex):(r=34===d?t._lastValidRowIndex+f<=o-1?n[t._lastValidRowIndex+f]:[o-1]:t._lastValidRowIndex-f<=n[0]?n[0]:n[t._lastValidRowIndex-f],t._lastRowIndex=r,t._lastValidRowIndex=u.Arr.indexByValue(n,r),a(r));else{if(h.rowIndex>t._lastRowIndex)if(h.rowIndex>=n[o-1])r=n[o-1];else{var g=t._lastValidRowIndex+f;r=g>o-1?n[o-1]:n[g]}else if(h.rowIndex<=n[0])r=n[0];else{var v=n[t._lastValidRowIndex-f];r=v?v:n[0]}t._lastRowIndex=h.rowIndex,a(r)}}},a=function(e,s,i){var l="row"!==e.defaultSelection?s.parentNode:s;if(t.paging&&t.Cpt.paging.nbPages>1){var a=t.Cpt.paging;e.nbRowsPerPage=a.pagingLength;var r=t.validRowsIndex,n=r.length,o=parseInt(a.startPagingRow,10)+parseInt(a.pagingLength,10),h=l.rowIndex;h===r[n-1]&&a.currentPageNb!==a.nbPages?a.setPage("last"):h==r[0]&&1!==a.currentPageNb?a.setPage("first"):h>r[o-1]&&hr[0]&&a.setPage("previous")}};if(t.paging&&(t.onAfterChangePage=function(t,e){var s=t.ExtRegistry.ezEditTable,i=s.Selection,l=i.GetActiveRow();l&&l.scrollIntoView(!1);var a=i.GetActiveCell();a&&a.scrollIntoView(!1)}),"row"===s.default_selection){var r=s.on_before_selected_row;s.on_before_selected_row=function(){a(arguments[0],arguments[1],arguments[2]),r&&r.call(null,arguments[0],arguments[1],arguments[2])};var n=s.on_after_selected_row;s.on_after_selected_row=function(){l(arguments[0],arguments[1],arguments[2]),n&&n.call(null,arguments[0],arguments[1],arguments[2])}}else{var o=s.on_before_selected_cell;s.on_before_selected_cell=function(){a(arguments[0],arguments[1],arguments[2]),o&&o.call(null,arguments[0],arguments[1],arguments[2])};var p=s.on_after_selected_cell;s.on_after_selected_cell=function(){l(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(t.editable){var d=s.on_added_dom_row;if(s.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.Cpt.paging.destroy(),t.Cpt.paging.addPaging()):t.Cpt.rowsCounter.refresh(),t.alternateBgs&&t.Cpt.alternateRows.init(),d&&d.call(null,arguments[0],arguments[1],arguments[2])},s.actions&&s.actions["delete"]){var c=s.actions["delete"].on_after_submit;s.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.Cpt.paging.destroy(),t.Cpt.paging.addPaging(!1)):t.Cpt.rowsCounter.refresh(),t.alternateBgs&&t.Cpt.alternateRows.init(),c&&c.call(null,arguments[0],arguments[1])}}}try{t.ExtRegistry.ezEditTable=new EditTable(t.id,s,e),t.ExtRegistry.ezEditTable.Init()}catch(f){console.log(s.err)}}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.fillSlcOnDemand&&this.resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Cpt.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Cpt.paging.resetPage(this.pgNbCookie);
+
+}},{key:"resetGridValues",value:function(t){if(this.fillSlcOnDemand){var e=this.Cpt.store.getFilterValues(t),s=this.getFiltersByType(this.fltTypeSlc,!0),i=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var l=0;lh):U?(u=E(t.replace(d,""),A),a=u>=h):G?(u=E(t.replace(c,""),A),a=h>=u):j?(u=E(t.replace(g,""),A),a=h>u):z?(u=E(t.replace(v,""),A),a=h.toString()!=u.toString()):K?(u=E(t.replace(b,""),A),a=h.toString()==u.toString()):m.test(t)?a=r._containsStr(t.replace(m,""),e,null,!1):F(t,A)?(u=E(t,A),a=h.toString()==u.toString()):O?a=p.Str.isEmpty(e):M&&(a=!p.Str.isEmpty(e));else if(r.hasColNbFormat&&r.colNbFormat[s]?(n=l(e,r.colNbFormat[s]),o=r.colNbFormat[s]):","===r.thousandsSeparator&&"."===r.decimalSeparator?(n=l(e,"us"),o="us"):(n=l(e,"eu"),o="eu"),I)a=n<=l(t.replace(d,""),o);else if(S)a=n>=l(t.replace(c,""),o);else if(k)a=nl(t.replace(g,""),o);else if(D)a=r._containsStr(t.replace(v,""),e)?!1:!0;else if(L)a=r._containsStr(t.replace(m,""),e,null,!1);else if(P)a=r._containsStr(t.replace(b,""),e,null,!0);else if(N)a=0===e.indexOf(t.replace(C,""))?!0:!1;else if(B){var W=t.replace(_,"");a=e.lastIndexOf(W,e.length-1)===e.length-1-(W.length-1)&&e.lastIndexOf(W,e.length-1)>-1?!0:!1}else if(O)a=p.Str.isEmpty(e);else if(M)a=!p.Str.isEmpty(e);else if(V)try{var $=t.replace(T,""),q=new RegExp($);a=q.test(e)}catch(Y){a=!1}else{var J=i["col_"+s];a=r._containsStr(t,e,J?J:r.fltTypeInp)}return a}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this);var s=this.tbl.rows,i=this.cfg,a=0;this.validRowsIndex=[];var r=this;this.highlightKeywords&&this.Cpt.highlightKeyword.unhighlightAll(),this.popUpFilters&&this.Cpt.popupFilter.buildIcons(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var n,o,d=new RegExp(this.leOperator),c=new RegExp(this.geOperator),f=new RegExp(this.lwOperator),g=new RegExp(this.grOperator),v=new RegExp(this.dfOperator),m=new RegExp(p.Str.rgxEsc(this.lkOperator)),b=new RegExp(this.eqOperator),C=new RegExp(this.stOperator),_=new RegExp(this.enOperator),y=new RegExp(this.anOperator),w=(new RegExp(this.curExp),this.emOperator),x=this.nmOperator,T=new RegExp(p.Str.rgxEsc(this.rgxOperator)),k=this.refRow;kL;L++){var N=this.searchArgs[this.singleSearchFlt?0:L],A=this.hasColDateType?this.colDateType[L]:this.defaultDateType;if(""!==N){var B=p.Str.matchCase(this.getCellData(L,I[L]),this.matchCase),O=N.split(this.orOperator),M=O.length>1?!0:!1,V=N.split(this.anOperator),H=V.length>1?!0:!1;if(M||H){for(var U,j=!1,G=M?O:V,z=0;zd;d++)if(d===t&&""===i[r].style.display){var f=p.Str.lower(this.getCellData(d,o[d])),g=this.colNbFormat?this.colNbFormat[t]:null,v=e?l(f,g):f;a.push(v)}}return a}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e,s=this.getFilterElement(t);if(!s)return"";var i=this.fltCol[t];if(i!==this.fltTypeMulti&&i!==this.fltTypeCheckList)e=s.value;else if(i===this.fltTypeMulti){e="";for(var l=0;l]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},l.create=function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var i=0;i0){var i=document.cookie,l=i.indexOf(s);if(-1!==l){l+=s.length;var a=i.indexOf(";",l);-1===a&&(a=i.length),e=unescape(i.substring(l,a))}}return e},i.remove=function(t){this.write(t,"",-1)},i.valueToArray=function(t,e){e||(e=",");var s=this.read(t),i=s.split(e);return i},i.getValueByIndex=function(t,e,s){s||(s=",");var i=this.valueToArray(t,s);return i[e]},e.Cookie=i},function(t,e,s){"use strict";var i={},l=void 0;i.isObj=function(t){var e=!1;return"string"==typeof t?window[t]&&"object"==typeof window[t]&&(e=!0):t&&"object"==typeof t&&(e=!0),e},i.isFn=function(t){return t&&t.constructor==Function},i.isArray=function(t){return t&&t.constructor==Array},i.isUndef=function(t){return t===l},e.Types=i},function(t,e,s){"use strict";var i=s(4),l={has:function(t,e,s){for(var l=void 0===s?!1:s,a=0;a2)return t;var e;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function i(t){if(void 0===t)return 0;for(var e,s=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],i=0;i11||23>e)&&(e-=12),1>e||e>12?0:e}if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var l,a;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),l=new Date(s(a[2]),i(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(s(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(s(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),l=new Date(s(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(s(a[2]),a[1]-1,a[0])}return l})};e.DateHelper=i},function(t,e,s){"use strict";var i=s(4),l={ignoreCase:function(t,e){var s=i.Str.lower(t),l=i.Str.lower(e);return l>s?-1:s>l?1:0}};e.Sort=l},function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},l=function(){function t(t,e){for(var s=0;s0&&i.removeChild(I[0]),this.headTbl.style.tableLayout="fixed",i.style.tableLayout="fixed",this.headTbl.cellPadding=i.cellPadding,this.headTbl.cellSpacing=i.cellSpacing,e.setColWidths(),this.headTblCont.style.width=this.tblCont.clientWidth+"px",i.style.width="",this.headTbl.style.width=i.clientWidth+"px",n.Event.add(this.tblCont,"scroll",function(e){var s=n.Event.target(e),i=s.scrollLeft;t.headTblCont.scrollLeft=i}),s.sort!==!1&&(e.sort=!0,e.sortConfig.asyncSort=!0,e.sortConfig.triggerIds=v),this.gridEnableColResizer&&(e.hasExtensions?e._containsStr("colsresizer",Str.lower(e.extensions.src.toString()))||(e.extensions.name.push("ColumnsResizer_"+e.id),e.extensions.src.push(e.gridColResizerPath),e.extensions.description.push("Columns Resizing"),e.extensions.initialize.push(function(t){t.SetColsResizer("ColumnsResizer_"+t.id)})):(e.extensions={name:["ColumnsResizer_"+e.id],src:[this.gridColResizerPath],description:["Columns Resizing"],initialize:[function(t){t.SetColsResizer("ColumnsResizer_"+t.id)}]},e.hasExtensions=!0)),s.col_resizer_cols_headers_table=this.headTbl.getAttribute("id"),s.col_resizer_cols_headers_index=this.gridHeadRowIndex,s.col_resizer_width_adjustment=0,s.col_enable_text_ellipsis=!1,this.tblHasColTag=a.Dom.tag(i,"col").length>0?!0:!1;var R=function(t){if(t){for(var s=e.nbCells-1;s>=0;s--){var l=a.Dom.create("col",["id",e.id+"_col_"+s]);i.firstChild.parentNode.insertBefore(l,i.firstChild),l.style.width=e.colWidth[s],t.gridColElms[s]=l}t.tblHasColTag=!0}};if(this.tblHasColTag)for(var S=a.Dom.tag(i,"col"),D=0;D ',this.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",this.onBeforePopUpOpen=a.Types.isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,this.onAfterPopUpOpen=a.Types.isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,this.onBeforePopUpClose=a.Types.isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,this.onAfterPopUpClose=a.Types.isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,this.popUpFltSpans=[],this.popUpFltImgs=[],this.popUpFltElms=this.popUpFltElmCache||[],this.popUpFltAdjustToContainer=!0,this.prfxPopUpSpan="popUpSpan_",this.prfxPopUpDiv="popUpDiv_",this.tf=t}return l(e,[{key:"onClick",value:function(e){var s=e||t.event,i=s.target.parentNode,l=parseInt(i.getAttribute("ci"),10);if(this.closeAll(l),this.toggle(l),this.popUpFltAdjustToContainer){var a=this.popUpFltElms[l],h=this.tf.getHeaderElement(l),p=.95*h.clientWidth;if(o.Helpers.isIE()){var d=r.Dom.position(h).left;a.style.left=d+"px"}a.style.width=parseInt(p,10)+"px"}n.Event.cancel(s),n.Event.stop(s)}},{key:"init",value:function(){for(var t=this,e=this.tf,s=0;sy;y++)if(t===y&&(!e||e&&l.disableExcludedOptions)||t==y&&e&&(""===d[b].style.display&&!l.paging||l.paging&&(!l.validRowsIndex||l.validRowsIndex&&r.Arr.has(l.validRowsIndex,b))&&(void 0===u||u==t||u!=t&&r.Arr.has(l.validRowsIndex,b)))){var w=l.getCellData(y,C[y]),x=n.Str.matchCase(w,c);if(r.Arr.has(this.opts,x,c)||this.opts.push(w),e&&l.disableExcludedOptions){var T=m[y];T||(T=this.GetFilteredDataCol(y)),r.Arr.has(T,x,c)||r.Arr.has(v,x,c)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var k=l.__getCustomValues(t);this.opts=k[0],this.optsTxt=k[1]}if(l.sortSlc&&!this.isCustom&&(c?(this.opts.sort(),v&&v.sort()):(this.opts.sort(o.Sort.ignoreCase),v&&v.sort(o.Sort.ignoreCase))),l.sortNumAsc&&r.Arr.has(l.sortNumAsc,t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(I){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(l.sortNumDesc&&r.Arr.has(l.sortNumDesc,t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(I){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,p,e,v,f,g)}}},{key:"addOptions",value:function(t,e,s,i,l,o){var h=this.tf,p=n.Str.lower(this.slcFillingMethod),d=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var c=0;c"+f+""}else{var m;m=h.fillSlcOnDemand&&d===this.opts[c]&&h["col"+t]===h.fltTypeSlc?a.Dom.createOpt(f,u,!0):h["col"+t]!==h.fltTypeMulti?a.Dom.createOpt(f,u," "!==l[t]&&u===l[t]?!0:!1):a.Dom.createOpt(f,u,r.Arr.has(o,n.Str.matchCase(this.opts[c],h.matchCase),h.matchCase)||-1!==o.toString().indexOf(u)?!0:!1),g&&(m.disabled=!0),e.appendChild(m)}}"innerhtml"===p&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,s=n.Str.lower(this.slcFillingMethod);if("innerhtml"===s)this.slcInnerHtml+=''+e.displayAllText+" ";else{var i=a.Dom.createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(i.style.display="none"),t.appendChild(i),e.enableEmptyOption){var l=a.Dom.createOpt(e.emptyText,e.emOperator);t.appendChild(l)}if(e.enableNonEmptyOption){var r=a.Dom.createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(r)}}return t}}]),t}();e.Dropdown=h},function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},l=function(){function t(t,e){for(var s=0;s_;_++)if(t===_&&(!l.refreshFilters||l.refreshFilters&&l.disableExcludedOptions)||t===_&&l.refreshFilters&&(""===u[m].style.display&&!l.paging||l.paging&&(!f||f===t||f!=t&&r.Arr.has(l.validRowsIndex,m)))){var y=l.getCellData(_,b[_]),w=n.Str.matchCase(y,l.matchCase);r.Arr.has(this.opts,w,l.matchCase)||this.opts.push(y);var x=v[_];l.refreshFilters&&l.disableExcludedOptions&&(x||(v[_]=l.GetFilteredDataCol(_)),r.Arr.has(x,w,l.matchCase)||r.Arr.has(g,w,l.matchCase)||l.isFirstLoad||g.push(y))}}if(this.isCustom){var T=l.__getCustomValues(t);this.opts=T[0],this.optsTxt=T[1]}if(l.sortSlc&&!this.isCustom&&(l.matchCase?(this.opts.sort(),g&&g.sort()):(this.opts.sort(o.Sort.ignoreCase),g&&g.sort(o.Sort.ignoreCase))),l.sortNumAsc&&r.Arr.has(l.sortNumAsc,t))try{this.opts.sort(numSortAsc),g&&g.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),g&&g.sort(),this.isCustom&&this.optsTxt.sort()}if(l.sortNumDesc&&r.Arr.has(l.sortNumDesc,t))try{this.opts.sort(numSortDesc),g&&g.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),g&&g.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,c,l.separator),l.fillSlcOnDemand&&(d.innerHTML=""),d.appendChild(c),d.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e,s){var i=this,l=this.tf,o=this.addTChecks(t,e),p=[],d=l.Cpt.store,c=d?d.getFilterValues(l.fltsValuesCookie)[t]:null;c&&n.Str.trim(c).length>0&&(l.hasCustomSlcOptions&&r.Arr.has(l.customSlcOptions.cols,t)?p.push(c):p=c.split(" "+l.orOperator+" "));for(var u=0;u0?1:0),a=l+i.pagingLength-1<=e.nbVisibleRows?l+i.pagingLength-1:e.nbVisibleRows;s=l+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else s=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows-(e.hasVisibleRows?e.visibleRows.length:0);this.rowsCounterSpan.innerHTML=s,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,s)}}},{key:"destroy",value:function(){var t=this.tf;t.hasGrid()&&this.rowsCounterSpan&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?n.Helpers.isIE()?this.rowsCounterDiv.outerHTML="":this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv):a.Dom.id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null)}}]),t}();e.RowsCounter=o},function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},l=function(){function t(t,e){for(var s=0;s",this.btnPrevPageText=s.btn_prev_page_text||"<",this.btnLastPageText=s.btn_last_page_text||">|",this.btnFirstPageText=s.btn_first_page_text||"|<",this.btnNextPageHtml=s.btn_next_page_html||(e.enableIcons?' ':null),this.btnPrevPageHtml=s.btn_prev_page_html||(e.enableIcons?' ':null),this.btnFirstPageHtml=s.btn_first_page_html||(e.enableIcons?' ':null),this.btnLastPageHtml=s.btn_last_page_html||(e.enableIcons?' ':null),this.pageText=s.page_text||" Page ",this.ofText=s.of_text||" of ",this.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",this.hasPagingBtns=s.paging_btns===!1?!1:!0,this.pageSelectorType=s.page_selector_type||e.fltTypeSlc,this.onBeforeChangePage=r.Types.isFn(s.on_before_change_page)?s.on_before_change_page:null,this.onAfterChangePage=r.Types.isFn(s.on_after_change_page)?s.on_after_change_page:null,this.prfxSlcPages="slcPages_",this.prfxSlcResults="slcResults_",this.prfxSlcResultsTxt="slcResultsTxt_",this.prfxBtnNextSpan="btnNextSpan_",this.prfxBtnPrevSpan="btnPrevSpan_",this.prfxBtnLastSpan="btnLastSpan_",this.prfxBtnFirstSpan="btnFirstSpan_",this.prfxBtnNext="btnNext_",this.prfxBtnPrev="btnPrev_",this.prfxBtnLast="btnLast_",this.prfxBtnFirst="btnFirst_",this.prfxPgSpan="pgspan_",this.prfxPgBeforeSpan="pgbeforespan_",this.prfxPgAfterSpan="pgafterspan_";var l=this.refRow,a=this.nbRows;this.nbPages=Math.ceil((a-l)/this.pagingLength);var n=this;this.evt={slcIndex:function(){return n.pageSelectorType===e.fltTypeSlc?n.pagingSlc.options.selectedIndex:parseInt(n.pagingSlc.value,10)-1},nbOpts:function(){return n.pageSelectorType===e.fltTypeSlc?parseInt(n.pagingSlc.options.length,10)-1:n.nbPages-1},next:function(){var t=n.evt.slcIndex()0?n.evt.slcIndex()-1:n.evt.nbOpts();n.changePage(t)},last:function(){n.changePage(n.evt.nbOpts())},first:function(){n.changePage(0)},_detectKey:function(t){var s=o.Event.keyCode(t);13===s&&(e.sorted?(e.filter(),n.changePage(n.evt.slcIndex())):n.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},this.tf=e}return l(t,[{key:"init",value:function(){var t,e=this,s=this.tf,i=this.evt;this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),i.slcPagesChange=function(t){e.changePage(),t.target.blur()},this.pageSelectorType===s.fltTypeSlc&&(t=a.Dom.create(s.fltTypeSlc,["id",this.prfxSlcPages+s.id]),t.className=this.pgSlcCssClass,o.Event.add(t,"change",i.slcPagesChange)),this.pageSelectorType===s.fltTypeInp&&(t=a.Dom.create(s.fltTypeInp,["id",this.prfxSlcPages+s.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,o.Event.add(t,"keypress",i._detectKey));var l=a.Dom.create("span",["id",this.prfxBtnNextSpan+s.id]),r=a.Dom.create("span",["id",this.prfxBtnPrevSpan+s.id]),n=a.Dom.create("span",["id",this.prfxBtnLastSpan+s.id]),h=a.Dom.create("span",["id",this.prfxBtnFirstSpan+s.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)l.innerHTML=this.btnNextPageHtml,o.Event.add(l,"click",i.next);else{var p=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnNext+s.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);p.className=this.btnPageCssClass,o.Event.add(p,"click",i.next),l.appendChild(p)}if(this.btnPrevPageHtml)r.innerHTML=this.btnPrevPageHtml,o.Event.add(r,"click",i.prev);else{var d=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnPrev+s.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);d.className=this.btnPageCssClass,o.Event.add(d,"click",i.prev),r.appendChild(d)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,o.Event.add(n,"click",i.last);else{var c=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnLast+s.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);c.className=this.btnPageCssClass,o.Event.add(c,"click",i.last),n.appendChild(c)}if(this.btnFirstPageHtml)h.innerHTML=this.btnFirstPageHtml,o.Event.add(h,"click",i.first);else{var u=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnFirst+s.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);u.className=this.btnPageCssClass,o.Event.add(u,"click",i.first),h.appendChild(u)}}this.pagingTgtId||s.setToolbar();var f=this.pagingTgtId?a.Dom.id(this.pagingTgtId):s.mDiv;f.appendChild(h),f.appendChild(r);var g=a.Dom.create("span",["id",this.prfxPgBeforeSpan+s.id]);g.appendChild(a.Dom.text(this.pageText)),g.className=this.nbPgSpanCssClass,f.appendChild(g),f.appendChild(t);var v=a.Dom.create("span",["id",this.prfxPgAfterSpan+s.id]);v.appendChild(a.Dom.text(this.ofText)),v.className=this.nbPgSpanCssClass,f.appendChild(v);var m=a.Dom.create("span",["id",this.prfxPgSpan+s.id]);m.className=this.nbPgSpanCssClass,m.appendChild(a.Dom.text(" "+this.nbPages+" ")),f.appendChild(m),f.appendChild(l),f.appendChild(n),this.pagingSlc=a.Dom.id(this.prfxSlcPages+s.id),(!s.rememberGridValues||this.isPagingRemoved)&&this.setPagingInfo(),s.fltGrid||(s.ValidateAllRows(),this.setPagingInfo(s.validRowsIndex)),this.isPagingRemoved=!1}},{key:"addPaging",value:function(){var t=void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!e.paging&&(e.paging=!0,this.isPagingRemoved=!0,this.init(),e.resetValues(),t&&e.filter())}},{key:"setPagingInfo",value:function(t){var e=this.tf,s=e.tbl.rows,i=this.pagingTgtId?a.Dom.id(this.pagingTgtId):e.mDiv,l=a.Dom.id(this.prfxPgSpan+e.id);if(t&&t.length>0)e.validRowsIndex=t;else{e.validRowsIndex=[];for(var r=e.refRow;r0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var h=0;h=this.startPagingRow&&i>l?("true"!==a.getAttribute("validRow")&&a.getAttribute("validRow")||(a.style.display=""),e.alternateBgs&&e.Cpt.alternateRows&&e.Cpt.alternateRows.setRowBg(e.validRowsIndex[l],l)):(a.style.display="none",e.alternateBgs&&e.Cpt.alternateRows&&e.Cpt.alternateRows.removeRowBg(e.validRowsIndex[l]))}e.nbVisibleRows=e.validRowsIndex.length,e.isStartBgAlternate=!1,e.applyGridProps()}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&e.paging){var s=this.evt,i=typeof t;if("string"===i)switch(n.Str.lower(t)){case"next":s.next();break;case"previous":s.prev();break;case"last":s.last();break;case"first":s.first();break;default:s.next()}else"number"===i&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,s=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){s.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var i=a.Dom.create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);i.className=e.resultsSlcCssClass;
+
+var l=this.resultsPerPage[0],r=this.resultsPerPage[1],n=a.Dom.create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var h=this.resultsPerPageTgtId?a.Dom.id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(a.Dom.text(l)),h.appendChild(n),h.appendChild(i),this.resultsPerPageSlc=a.Dom.id(this.prfxSlcResults+e.id);for(var p=0;p=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.Cpt.store.savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(t.paging){var e=this.resultsPerPageSlc,s=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*s,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var i=this.pagingSlc.options.length-1<=s?this.pagingSlc.options.length-1:s;this.pagingSlc.options[i].selected=!0}t.rememberPageLen&&t.Cpt.store.savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,s=e.Cpt.store.getPageNb(t);""!==s&&this.changePage(s-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(e.paging){var s=e.Cpt.store.getPageLength(t);""!==s&&(this.resultsPerPageSlc.options[s].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this.tf;if(t.hasGrid()){var e,s,i,l,r,n,h;e=a.Dom.id(this.prfxBtnNextSpan+t.id),s=a.Dom.id(this.prfxBtnPrevSpan+t.id),i=a.Dom.id(this.prfxBtnLastSpan+t.id),l=a.Dom.id(this.prfxBtnFirstSpan+t.id),r=a.Dom.id(this.prfxPgBeforeSpan+t.id),n=a.Dom.id(this.prfxPgAfterSpan+t.id),h=a.Dom.id(this.prfxPgSpan+t.id);var p=this.evt;this.pagingSlc&&(this.pageSelectorType===t.fltTypeSlc?o.Event.remove(this.pagingSlc,"change",p.slcPagesChange):this.pageSelectorType===t.fltTypeInp&&o.Event.remove(this.pagingSlc,"keypress",p._detectKey),this.pagingSlc.parentNode.removeChild(this.pagingSlc)),e&&(o.Event.remove(e,"click",p.next),e.parentNode.removeChild(e)),s&&(o.Event.remove(s,"click",p.prev),s.parentNode.removeChild(s)),i&&(o.Event.remove(i,"click",p.last),i.parentNode.removeChild(i)),l&&(o.Event.remove(l,"click",p.first),l.parentNode.removeChild(l)),r&&r.parentNode.removeChild(r),n&&n.parentNode.removeChild(n),h&&h.parentNode.removeChild(h),this.hasResultsPerPage&&this.removeResultsPerPage(),this.pagingSlc=null,this.nbPages=0,this.isPagingRemoved=!0,t.paging=!1}}}]),t}();e.Paging=h},function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},l=function(){function t(t,e){for(var s=0;s ':null),this.prfxResetSpan="resetspan_",this.tf=e}return l(t,[{key:"onClick",value:function(){this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(e.hasGrid()||e.isFirstLoad||!e.btnResetEl){var s=a.Dom.create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var i=this.btnResetTgtId?a.Dom.id(this.btnResetTgtId):e.rDiv;if(i.appendChild(s),this.btnResetHtml){s.innerHTML=this.btnResetHtml;var l=s.firstChild;r.Event.add(l,"click",function(){t.onClick()})}else{var n=a.Dom.create("a",["href","javascript:void(0);"]);n.className=e.btnResetCssClass,n.appendChild(a.Dom.text(this.btnResetText)),s.appendChild(n),r.Event.add(n,"click",function(){t.onClick()})}this.btnResetEl=s.firstChild}}},{key:"destroy",value:function(){var t=this.tf;if(t.hasGrid()&&this.btnResetEl){var e=a.Dom.id(t.prfxResetSpan+t.id);e&&e.parentNode.removeChild(e),this.btnResetEl=null}}}]),t}();e.ClearButton=n},function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},l=function(){function t(t,e){for(var s=0;s< , <= , > , >= , = , * , ! , { , } , || ,&& , [empty] , [nonempty] , rgx: These operators are described here:http://tablefilter.free.fr/#operators ',this.helpInstrHtml=s.help_instructions_html||null,this.helpInstrBtnText=s.help_instructions_btn_text||"?",this.helpInstrBtnHtml=s.help_instructions_btn_html||null,this.helpInstrBtnCssClass=s.help_instructions_btn_css_class||"helpBtn",this.helpInstrContCssClass=s.help_instructions_container_css_class||"helpCont",this.helpInstrBtnEl=null,this.helpInstrContEl=null,this.helpInstrDefaultHtml='',this.prfxHelpSpan="helpSpan_",this.prfxHelpDiv="helpDiv_",this.tf=e}return l(t,[{key:"init",value:function(){var t=this;if(!this.helpInstrBtnEl){var e=this.tf,s=a.Dom.create("span",["id",this.prfxHelpSpan+e.id]),i=a.Dom.create("div",["id",this.prfxHelpDiv+e.id]);this.helpInstrTgtId||e.setToolbar();var l=this.helpInstrTgtId?a.Dom.id(this.helpInstrTgtId):e.rDiv;l.appendChild(s);var n=this.helpInstrContTgtId?a.Dom.id(this.helpInstrContTgtId):s;if(this.helpInstrBtnHtml){s.innerHTML=this.helpInstrBtnHtml;var o=s.firstChild;r.Event.add(o,"click",function(){t.toggle()}),n.appendChild(i)}else{n.appendChild(i);var h=a.Dom.create("a",["href","javascript:void(0);"]);h.className=this.helpInstrBtnCssClass,h.appendChild(a.Dom.text(this.helpInstrBtnText)),s.appendChild(h),r.Event.add(h,"click",function(){t.toggle()})}this.helpInstrHtml?(this.helpInstrContTgtId&&n.appendChild(i),i.innerHTML=this.helpInstrHtml,this.helpInstrContTgtId||(i.className=this.helpInstrContCssClass,r.Event.add(i,"dblclick",function(){t.toggle()}))):(i.innerHTML=this.helpInstrText,i.className=this.helpInstrContCssClass,r.Event.add(i,"dblclick",function(){t.toggle()})),i.innerHTML+=this.helpInstrDefaultHtml,r.Event.add(i,"click",function(){t.toggle()}),this.helpInstrContEl=i,this.helpInstrBtnEl=s}}},{key:"toggle",value:function(){if(this.helpInstrContEl){var t=this.helpInstrContEl.style.display;if(""===t||"none"===t){this.helpInstrContEl.style.display="block";var e=a.Dom.position(this.helpInstrBtnEl).left;this.helpInstrContTgtId||(this.helpInstrContEl.style.left=e-this.helpInstrContEl.clientWidth+25+"px")}else this.helpInstrContEl.style.display="none"}}},{key:"destroy",value:function(){this.helpInstrBtnEl&&(this.helpInstrBtnEl.parentNode.removeChild(this.helpInstrBtnEl),this.helpInstrBtnEl=null,this.helpInstrContEl&&(this.helpInstrContEl.parentNode.removeChild(this.helpInstrContEl),this.helpInstrContEl=null))}}]),t}();e.Help=n},function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},l=function(){function t(t,e){for(var s=0;sl;l++){var a=t?l:this.tf.validRowsIndex[l];this.setRowBg(a,i),i++}}},{key:"setRowBg",value:function(t,e){if(this.tf.alternateBgs&&!isNaN(t)){var s=this.tf.tbl.rows,i=e?e:t;this.removeRowBg(t),a.Dom.addClass(s[t],i%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;a.Dom.removeClass(e[t],this.oddCss),a.Dom.removeClass(e[t],this.evenCss)}}},{key:"remove",value:function(){if(this.tf.hasGrid()){for(var t=(this.tf.tbl.rows,this.tf.refRow);t=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_Str.Str.lower(typeof labelId)&&"object"==_Str.Str.lower(typeof colIndex)&&"object"==_Str.Str.lower(typeof operation))for(var row=this.tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(this.tf.getColValues(ucolIndex[ucol],!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;kmaxValue?parseFloat(cvalue):maxValue))}if(1===meanFlag&&(meanValue=sumValue/nbvalues),1===medFlag){var aux=0;nbvalues%2===1?(aux=Math.floor(nbvalues/2),medValue=theList[aux]):medValue=(theList[nbvalues/2]+theList[nbvalues/2-1])/2}var posa;if(1===q1Flag&&(posa=0,posa=Math.floor(nbvalues/4),q1Value=4*posa==nbvalues?(theList[posa-1]+theList[posa])/2:theList[posa]),1===q3Flag){posa=0;var posb=0;posa=Math.floor(nbvalues/4),4*posa===nbvalues?(posb=3*posa,q3Value=(theList[posb]+theList[posb-1])/2):q3Value=theList[nbvalues-posa-1]}for(var i=0;mThisCol>=i;i++){switch(opsThisCol[i]){case"mean":result=meanValue;break;case"sum":result=sumValue;break;case"min":result=minValue;break;case"max":result=maxValue;break;case"median":result=medValue;break;case"q1":result=q1Value;break;case"q3":result=q3Value}var precision=isNaN(decThisCol[i])?2:decThisCol[i];if(oTypeThisCol&&result){if(result=result.toFixed(precision),_Dom.Dom.id(labThisCol[i]))switch(_Str.Str.lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_Dom.Dom.id(labThisCol[i]).innerHTML=".":_Dom.Dom.id(labThisCol[i]).innerHTML=result;break;case"setvalue":_Dom.Dom.id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_Dom.Dom.id(labThisCol[i]).firstChild,txtnode=_Dom.Dom.text(result);_Dom.Dom.id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_Dom.Dom.id(labThisCol[i]).innerHTML=".":_Dom.Dom.id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?row[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,this.tf)}}}]),ColOps}();exports.ColOps=ColOps}])});
\ No newline at end of file
diff --git a/dist/TF_Themes/Default/TF_Default.css b/dist/tablefilter/themes/Default/TF_Default.css
similarity index 100%
rename from dist/TF_Themes/Default/TF_Default.css
rename to dist/tablefilter/themes/Default/TF_Default.css
diff --git a/dist/TF_Themes/Default/images/bg_infDiv.jpg b/dist/tablefilter/themes/Default/images/bg_infDiv.jpg
similarity index 100%
rename from dist/TF_Themes/Default/images/bg_infDiv.jpg
rename to dist/tablefilter/themes/Default/images/bg_infDiv.jpg
diff --git a/dist/TF_Themes/Default/images/bg_th.jpg b/dist/tablefilter/themes/Default/images/bg_th.jpg
similarity index 100%
rename from dist/TF_Themes/Default/images/bg_th.jpg
rename to dist/tablefilter/themes/Default/images/bg_th.jpg
diff --git a/dist/TF_Themes/Default/images/btn_eraser.gif b/dist/tablefilter/themes/Default/images/btn_eraser.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/btn_eraser.gif
rename to dist/tablefilter/themes/Default/images/btn_eraser.gif
diff --git a/dist/TF_Themes/Default/images/btn_first_page.gif b/dist/tablefilter/themes/Default/images/btn_first_page.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/btn_first_page.gif
rename to dist/tablefilter/themes/Default/images/btn_first_page.gif
diff --git a/dist/TF_Themes/Default/images/btn_last_page.gif b/dist/tablefilter/themes/Default/images/btn_last_page.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/btn_last_page.gif
rename to dist/tablefilter/themes/Default/images/btn_last_page.gif
diff --git a/dist/TF_Themes/Default/images/btn_next_page.gif b/dist/tablefilter/themes/Default/images/btn_next_page.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/btn_next_page.gif
rename to dist/tablefilter/themes/Default/images/btn_next_page.gif
diff --git a/dist/TF_Themes/Default/images/btn_over_eraser.gif b/dist/tablefilter/themes/Default/images/btn_over_eraser.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/btn_over_eraser.gif
rename to dist/tablefilter/themes/Default/images/btn_over_eraser.gif
diff --git a/dist/TF_Themes/Default/images/btn_over_first_page.gif b/dist/tablefilter/themes/Default/images/btn_over_first_page.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/btn_over_first_page.gif
rename to dist/tablefilter/themes/Default/images/btn_over_first_page.gif
diff --git a/dist/TF_Themes/Default/images/btn_over_last_page.gif b/dist/tablefilter/themes/Default/images/btn_over_last_page.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/btn_over_last_page.gif
rename to dist/tablefilter/themes/Default/images/btn_over_last_page.gif
diff --git a/dist/TF_Themes/Default/images/btn_over_next_page.gif b/dist/tablefilter/themes/Default/images/btn_over_next_page.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/btn_over_next_page.gif
rename to dist/tablefilter/themes/Default/images/btn_over_next_page.gif
diff --git a/dist/TF_Themes/Default/images/btn_over_previous_page.gif b/dist/tablefilter/themes/Default/images/btn_over_previous_page.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/btn_over_previous_page.gif
rename to dist/tablefilter/themes/Default/images/btn_over_previous_page.gif
diff --git a/dist/TF_Themes/Default/images/btn_previous_page.gif b/dist/tablefilter/themes/Default/images/btn_previous_page.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/btn_previous_page.gif
rename to dist/tablefilter/themes/Default/images/btn_previous_page.gif
diff --git a/dist/TF_Themes/Default/images/img_loading.gif b/dist/tablefilter/themes/Default/images/img_loading.gif
similarity index 100%
rename from dist/TF_Themes/Default/images/img_loading.gif
rename to dist/tablefilter/themes/Default/images/img_loading.gif
diff --git a/dist/TF_Themes/MyTheme/MyTheme.css b/dist/tablefilter/themes/MyTheme/MyTheme.css
similarity index 100%
rename from dist/TF_Themes/MyTheme/MyTheme.css
rename to dist/tablefilter/themes/MyTheme/MyTheme.css
diff --git a/dist/TF_Themes/MyTheme/images/bg_headers.jpg b/dist/tablefilter/themes/MyTheme/images/bg_headers.jpg
similarity index 100%
rename from dist/TF_Themes/MyTheme/images/bg_headers.jpg
rename to dist/tablefilter/themes/MyTheme/images/bg_headers.jpg
diff --git a/dist/TF_Themes/MyTheme/images/bg_infDiv.jpg b/dist/tablefilter/themes/MyTheme/images/bg_infDiv.jpg
similarity index 100%
rename from dist/TF_Themes/MyTheme/images/bg_infDiv.jpg
rename to dist/tablefilter/themes/MyTheme/images/bg_infDiv.jpg
diff --git a/dist/TF_Themes/MyTheme/images/btn_filter.png b/dist/tablefilter/themes/MyTheme/images/btn_filter.png
similarity index 100%
rename from dist/TF_Themes/MyTheme/images/btn_filter.png
rename to dist/tablefilter/themes/MyTheme/images/btn_filter.png
diff --git a/dist/TF_Themes/MyTheme/images/btn_first_page.gif b/dist/tablefilter/themes/MyTheme/images/btn_first_page.gif
similarity index 100%
rename from dist/TF_Themes/MyTheme/images/btn_first_page.gif
rename to dist/tablefilter/themes/MyTheme/images/btn_first_page.gif
diff --git a/dist/TF_Themes/MyTheme/images/btn_last_page.gif b/dist/tablefilter/themes/MyTheme/images/btn_last_page.gif
similarity index 100%
rename from dist/TF_Themes/MyTheme/images/btn_last_page.gif
rename to dist/tablefilter/themes/MyTheme/images/btn_last_page.gif
diff --git a/dist/TF_Themes/MyTheme/images/btn_next_page.gif b/dist/tablefilter/themes/MyTheme/images/btn_next_page.gif
similarity index 100%
rename from dist/TF_Themes/MyTheme/images/btn_next_page.gif
rename to dist/tablefilter/themes/MyTheme/images/btn_next_page.gif
diff --git a/dist/TF_Themes/MyTheme/images/btn_previous_page.gif b/dist/tablefilter/themes/MyTheme/images/btn_previous_page.gif
similarity index 100%
rename from dist/TF_Themes/MyTheme/images/btn_previous_page.gif
rename to dist/tablefilter/themes/MyTheme/images/btn_previous_page.gif
diff --git a/dist/TF_Themes/MyTheme/images/img_loading.gif b/dist/tablefilter/themes/MyTheme/images/img_loading.gif
similarity index 100%
rename from dist/TF_Themes/MyTheme/images/img_loading.gif
rename to dist/tablefilter/themes/MyTheme/images/img_loading.gif
diff --git a/dist/TF_Themes/SkyBlue/TF_SkyBlue.css b/dist/tablefilter/themes/SkyBlue/TF_SkyBlue.css
similarity index 100%
rename from dist/TF_Themes/SkyBlue/TF_SkyBlue.css
rename to dist/tablefilter/themes/SkyBlue/TF_SkyBlue.css
diff --git a/dist/TF_Themes/SkyBlue/images/bg_skyblue.gif b/dist/tablefilter/themes/SkyBlue/images/bg_skyblue.gif
similarity index 100%
rename from dist/TF_Themes/SkyBlue/images/bg_skyblue.gif
rename to dist/tablefilter/themes/SkyBlue/images/bg_skyblue.gif
diff --git a/dist/TF_Themes/SkyBlue/images/btn_first_page.gif b/dist/tablefilter/themes/SkyBlue/images/btn_first_page.gif
similarity index 100%
rename from dist/TF_Themes/SkyBlue/images/btn_first_page.gif
rename to dist/tablefilter/themes/SkyBlue/images/btn_first_page.gif
diff --git a/dist/TF_Themes/SkyBlue/images/btn_last_page.gif b/dist/tablefilter/themes/SkyBlue/images/btn_last_page.gif
similarity index 100%
rename from dist/TF_Themes/SkyBlue/images/btn_last_page.gif
rename to dist/tablefilter/themes/SkyBlue/images/btn_last_page.gif
diff --git a/dist/TF_Themes/SkyBlue/images/btn_next_page.gif b/dist/tablefilter/themes/SkyBlue/images/btn_next_page.gif
similarity index 100%
rename from dist/TF_Themes/SkyBlue/images/btn_next_page.gif
rename to dist/tablefilter/themes/SkyBlue/images/btn_next_page.gif
diff --git a/dist/TF_Themes/SkyBlue/images/btn_prev_page.gif b/dist/tablefilter/themes/SkyBlue/images/btn_prev_page.gif
similarity index 100%
rename from dist/TF_Themes/SkyBlue/images/btn_prev_page.gif
rename to dist/tablefilter/themes/SkyBlue/images/btn_prev_page.gif
diff --git a/dist/TF_Themes/SkyBlue/images/icn_clear_filters.png b/dist/tablefilter/themes/SkyBlue/images/icn_clear_filters.png
similarity index 100%
rename from dist/TF_Themes/SkyBlue/images/icn_clear_filters.png
rename to dist/tablefilter/themes/SkyBlue/images/icn_clear_filters.png
diff --git a/dist/TF_Themes/SkyBlue/images/img_loading.gif b/dist/tablefilter/themes/SkyBlue/images/img_loading.gif
similarity index 100%
rename from dist/TF_Themes/SkyBlue/images/img_loading.gif
rename to dist/tablefilter/themes/SkyBlue/images/img_loading.gif
diff --git a/dist/TF_Themes/blank.png b/dist/tablefilter/themes/blank.png
similarity index 100%
rename from dist/TF_Themes/blank.png
rename to dist/tablefilter/themes/blank.png
diff --git a/dist/TF_Themes/btn_clear_filters.png b/dist/tablefilter/themes/btn_clear_filters.png
similarity index 100%
rename from dist/TF_Themes/btn_clear_filters.png
rename to dist/tablefilter/themes/btn_clear_filters.png
diff --git a/dist/TF_Themes/btn_filter.png b/dist/tablefilter/themes/btn_filter.png
similarity index 100%
rename from dist/TF_Themes/btn_filter.png
rename to dist/tablefilter/themes/btn_filter.png
diff --git a/dist/TF_Themes/btn_first_page.gif b/dist/tablefilter/themes/btn_first_page.gif
similarity index 100%
rename from dist/TF_Themes/btn_first_page.gif
rename to dist/tablefilter/themes/btn_first_page.gif
diff --git a/dist/TF_Themes/btn_last_page.gif b/dist/tablefilter/themes/btn_last_page.gif
similarity index 100%
rename from dist/TF_Themes/btn_last_page.gif
rename to dist/tablefilter/themes/btn_last_page.gif
diff --git a/dist/TF_Themes/btn_next_page.gif b/dist/tablefilter/themes/btn_next_page.gif
similarity index 100%
rename from dist/TF_Themes/btn_next_page.gif
rename to dist/tablefilter/themes/btn_next_page.gif
diff --git a/dist/TF_Themes/btn_previous_page.gif b/dist/tablefilter/themes/btn_previous_page.gif
similarity index 100%
rename from dist/TF_Themes/btn_previous_page.gif
rename to dist/tablefilter/themes/btn_previous_page.gif
diff --git a/dist/TF_Themes/downsimple.png b/dist/tablefilter/themes/downsimple.png
similarity index 100%
rename from dist/TF_Themes/downsimple.png
rename to dist/tablefilter/themes/downsimple.png
diff --git a/dist/TF_Themes/icn_filter.gif b/dist/tablefilter/themes/icn_filter.gif
similarity index 100%
rename from dist/TF_Themes/icn_filter.gif
rename to dist/tablefilter/themes/icn_filter.gif
diff --git a/dist/TF_Themes/icn_filterActive.gif b/dist/tablefilter/themes/icn_filterActive.gif
similarity index 100%
rename from dist/TF_Themes/icn_filterActive.gif
rename to dist/tablefilter/themes/icn_filterActive.gif
diff --git a/dist/TF_Themes/upsimple.png b/dist/tablefilter/themes/upsimple.png
similarity index 100%
rename from dist/TF_Themes/upsimple.png
rename to dist/tablefilter/themes/upsimple.png
diff --git a/examples/dev-complex.html b/examples/dev-complex.html
new file mode 100644
index 00000000..dfce6f93
--- /dev/null
+++ b/examples/dev-complex.html
@@ -0,0 +1,179 @@
+
+
+
+ HTML Table Filter Generator
+
+
+
+
+
+
+ From
+ Destination
+ Road Distance (km)
+ By Air (hrs)
+ By Rail (hrs)
+
+
+
+
+
+ Sydney
+ Adelaide
+ 1412
+ 1.4
+ 25.3
+
+
+ Sydney
+ Brisbane
+ 982
+ 1.5
+ 16
+
+
+ Sydney
+ Canberra
+ 286
+ .6
+ 4.3
+
+
+ Sydney
+ Melbourne
+ 872
+ 1.1
+ 10.5
+
+
+ Adelaide
+ Perth
+ 2781
+ 3.1
+ 38
+
+
+ Adelaide
+ Alice Springs
+ 1533
+ 2
+ 20.25
+
+
+ Adelaide
+ Brisbane
+ 2045
+ 2.15
+ 40
+
+
+
+
+
+
+
+ Toggle col 2
+
+
\ No newline at end of file
diff --git a/examples/dev.html b/examples/dev.html
new file mode 100644
index 00000000..216ee164
--- /dev/null
+++ b/examples/dev.html
@@ -0,0 +1,153 @@
+
+
+
+ HTML Table Filter Generator
+
+
+
+
+
+ From
+ Destination
+ Road Distance (km)
+ By Air (hrs)
+ By Rail (hrs)
+
+
+
+
+ Tot:
+
+
+
+
+
+
+
+
+ Sydney
+ Adelaide
+ 1412
+ 1.4
+ 25.3
+
+
+ Sydney
+ Brisbane
+ 982
+ 1.5
+ 16
+
+
+ Sydney
+ Canberra
+ 286
+ .6
+ 4.3
+
+
+ Sydney
+ Melbourne
+ 872
+ 1.1
+ 10.5
+
+
+ Adelaide
+ Perth
+ 2781
+ 3.1
+ 38
+
+
+ Adelaide
+ Alice Springs
+ 1533
+ 2
+ 20.25
+
+
+ Adelaide
+ Brisbane
+ 2045
+ 2.15
+ 40
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/complex.html b/examples/dist-complex.html
similarity index 98%
rename from example/complex.html
rename to examples/dist-complex.html
index 570d9dcc..ccb69569 100644
--- a/example/complex.html
+++ b/examples/dist-complex.html
@@ -78,7 +78,7 @@
-
+
+
@@ -69,7 +68,7 @@
-
+
diff --git a/test/test-checklist.html b/test/test-checklist.html
index 34a7ade0..f6a9a54c 100644
--- a/test/test-checklist.html
+++ b/test/test-checklist.html
@@ -4,7 +4,6 @@
TableFilter checklist
-
@@ -69,7 +68,7 @@
-
+
diff --git a/test/test-clear-button.html b/test/test-clear-button.html
index c2b053ff..2bbe6737 100644
--- a/test/test-clear-button.html
+++ b/test/test-clear-button.html
@@ -4,7 +4,6 @@
TableFilter clear button
-
@@ -69,7 +68,7 @@
-
+
diff --git a/test/test-col-ops.html b/test/test-col-ops.html
index ac17c936..bcb6b89b 100644
--- a/test/test-col-ops.html
+++ b/test/test-col-ops.html
@@ -4,7 +4,6 @@
TableFilter column operations tests
-
@@ -78,7 +77,7 @@
-
+
diff --git a/test/test-dropdown.html b/test/test-dropdown.html
index 65569dbf..d156020e 100644
--- a/test/test-dropdown.html
+++ b/test/test-dropdown.html
@@ -4,7 +4,6 @@
TableFilter drop-down filter
-
@@ -69,7 +68,7 @@
-
+
diff --git a/test/test-grid-layout.html b/test/test-grid-layout.html
index ab10b6a6..5c980dce 100644
--- a/test/test-grid-layout.html
+++ b/test/test-grid-layout.html
@@ -4,7 +4,6 @@
TableFilter grid layout
-
@@ -7727,7 +7726,7 @@
-
+
diff --git a/test/test-help.html b/test/test-help.html
index bc9a901f..18bd71d2 100644
--- a/test/test-help.html
+++ b/test/test-help.html
@@ -4,7 +4,6 @@
TableFilter help pop-up
-
@@ -69,7 +68,7 @@
-
+
diff --git a/test/test-highlight-keywords.html b/test/test-highlight-keywords.html
index 0c49aabd..fffaafdb 100644
--- a/test/test-highlight-keywords.html
+++ b/test/test-highlight-keywords.html
@@ -4,7 +4,6 @@
TableFilter basic test
-
@@ -69,7 +68,7 @@
-
+
diff --git a/test/test-loader.html b/test/test-loader.html
index c482904d..d95c3608 100644
--- a/test/test-loader.html
+++ b/test/test-loader.html
@@ -4,13 +4,7 @@
TableFilter basic test
-
-
-
+
+
diff --git a/test/test-loader.js b/test/test-loader.js
index cafb88fd..8d8d4a07 100644
--- a/test/test-loader.js
+++ b/test/test-loader.js
@@ -1,21 +1,18 @@
-requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){
- QUnit.start();
+var tf = new TableFilter('demo', {
+ base_path: '../dist/tablefilter/',
+ loader: true
+});
+tf.init();
- var dom = require('dom').Dom,
- Loader = require('modules/loader').Loader;
-
- var tf = new TableFilter('demo', {
- loader: true
- });
- tf.init();
-
- module('Sanity checks');
- test('Loader component', function() {
- var loader = tf.Cpt.loader;
- deepEqual(loader instanceof Loader, true, 'Loader constructor');
- notEqual(loader, null, 'Loader instanciated');
- notEqual(dom.id(loader.prfxLoader+tf.id), null, 'Loader DOM container');
- });
-
-});
\ No newline at end of file
+module('Sanity checks');
+test('Loader component', function() {
+ var loader = tf.Cpt.loader;
+ notEqual(loader, null, 'Loader instanciated');
+ console.log(document.getElementById(loader.prfxLoader+tf.id));
+ notEqual(
+ document.getElementById(loader.prfxLoader+tf.id),
+ null,
+ 'Loader DOM container'
+ );
+});
diff --git a/test/test-paging.html b/test/test-paging.html
index 619c6b88..ceda6795 100644
--- a/test/test-paging.html
+++ b/test/test-paging.html
@@ -4,13 +4,7 @@
TableFilter paging
-
-
-
+
+
diff --git a/test/test-paging.js b/test/test-paging.js
index 5d34355f..3e699bbd 100644
--- a/test/test-paging.js
+++ b/test/test-paging.js
@@ -1,45 +1,39 @@
-requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){
- QUnit.start();
-
- var Paging = require('modules/paging').Paging,
- dom = require('dom').Dom;
-
- var tf = new TableFilter('demo', {
- paging: true,
- paging_length: 2,
- results_per_page: ['Results per page', [2,4,6]]
- });
- tf.init();
-
- var paging = tf.Cpt.paging;
- module('Sanity checks');
- test('Paging component', function() {
- deepEqual(paging instanceof Paging, true, 'Paging type');
- notEqual(paging, null, 'Paging instanciated');
- deepEqual(paging.pagingLength, 2, 'Paging length');
- deepEqual(paging.nbPages, 4, 'Number of pages');
- });
-
- module('UI elements');
- test('Paging UI elements', function() {
- notEqual(paging.pagingSlc, null, 'Paging drop-down element');
- notEqual(paging.resultsPerPageSlc, null, 'Number of results per page drop-down element');
- notEqual(dom.id(paging.prfxBtnNextSpan+tf.id), null, 'Next button container element');
- notEqual(dom.id(paging.prfxBtnPrevSpan+tf.id), null, 'Previous button container element');
- notEqual(dom.id(paging.prfxBtnLastSpan+tf.id), null, 'Last button container element');
- notEqual(dom.id(paging.prfxBtnFirstSpan+tf.id), null, 'First button container element');
- });
-
- test('Destroy Paging component', function() {
- paging.destroy();
- deepEqual(paging.pagingSlc, null, 'Paging drop-down element');
- deepEqual(paging.resultsPerPageSlc, null, 'Paging drop-down element');
- deepEqual(dom.id(paging.prfxBtnNextSpan+tf.id), null, 'Next button container element');
- deepEqual(dom.id(paging.prfxBtnPrevSpan+tf.id), null, 'Previous button container element');
- deepEqual(dom.id(paging.prfxBtnLastSpan+tf.id), null, 'Last button container element');
- deepEqual(dom.id(paging.prfxBtnFirstSpan+tf.id), null, 'First button container element');
- deepEqual(paging.nbPages, 0, 'Number of pages');
- });
+var id = function (id){ return document.getElementById(id); };
+var tf = new TableFilter('demo', {
+ base_path: '../dist/tablefilter/',
+ paging: true,
+ paging_length: 2,
+ results_per_page: ['Results per page', [2,4,6]]
+});
+tf.init();
+
+var paging = tf.Cpt.paging;
+module('Sanity checks');
+test('Paging component', function() {
+ notEqual(paging, null, 'Paging instanciated');
+ deepEqual(paging.pagingLength, 2, 'Paging length');
+ deepEqual(paging.nbPages, 4, 'Number of pages');
+});
+
+module('UI elements');
+test('Paging UI elements', function() {
+ notEqual(paging.pagingSlc, null, 'Paging drop-down element');
+ notEqual(paging.resultsPerPageSlc, null, 'Number of results per page drop-down element');
+ notEqual(id(paging.prfxBtnNextSpan+tf.id), null, 'Next button container element');
+ notEqual(id(paging.prfxBtnPrevSpan+tf.id), null, 'Previous button container element');
+ notEqual(id(paging.prfxBtnLastSpan+tf.id), null, 'Last button container element');
+ notEqual(id(paging.prfxBtnFirstSpan+tf.id), null, 'First button container element');
+});
+
+test('Destroy Paging component', function() {
+ paging.destroy();
+ deepEqual(paging.pagingSlc, null, 'Paging drop-down element');
+ deepEqual(paging.resultsPerPageSlc, null, 'Paging drop-down element');
+ deepEqual(id(paging.prfxBtnNextSpan+tf.id), null, 'Next button container element');
+ deepEqual(id(paging.prfxBtnPrevSpan+tf.id), null, 'Previous button container element');
+ deepEqual(id(paging.prfxBtnLastSpan+tf.id), null, 'Last button container element');
+ deepEqual(id(paging.prfxBtnFirstSpan+tf.id), null, 'First button container element');
+ deepEqual(paging.nbPages, 0, 'Number of pages');
});
diff --git a/test/test-popup-filter.html b/test/test-popup-filter.html
index 6404c3d3..9776a26d 100644
--- a/test/test-popup-filter.html
+++ b/test/test-popup-filter.html
@@ -4,13 +4,7 @@
TableFilter pop-up filter
-
-
-
+
+
diff --git a/test/test-popup-filter.js b/test/test-popup-filter.js
index 6b5e8a18..844a8d72 100644
--- a/test/test-popup-filter.js
+++ b/test/test-popup-filter.js
@@ -1,51 +1,44 @@
-requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){
- QUnit.start();
-
- var PopupFilter = require('modules/popupFilter').PopupFilter,
- types = require('types').Types,
- dom = require('dom').Dom;
-
- var tf = new TableFilter('demo', {
- col_2: 'multiple',
- col_3: 'select',
- popup_filters: true
- });
- tf.init();
-
- var popupFilter = tf.Cpt.popupFilter;
- module('Sanity checks');
- test('Pop-up filter component', function() {
- deepEqual(popupFilter instanceof PopupFilter, true, 'PopupFilter type');
- notEqual(popupFilter, null, 'PopupFilter instanciated');
- deepEqual(types.isArray(popupFilter.popUpFltElms), true, 'Type of popUpFltElms property');
- });
-
- module('UI elements');
- test('Pop-up filter UI elements', function() {
- var flt1 = dom.id(tf.fltIds[3]);
- var flt2 = dom.id(tf.fltIds[2]);
- var fltIcn1 = tf.Cpt.popupFilter.popUpFltImgs[3];
- var fltIcn2 = tf.Cpt.popupFilter.popUpFltImgs[2];
- notEqual(flt1, null, 'Filter element exists');
- notEqual(flt2, null, 'Filter element exists');
- deepEqual(flt2.hasAttribute('multiple'), true, 'Multiple select exists');
- deepEqual(fltIcn1.nodeName, 'IMG', 'Filter icon exists');
- deepEqual(fltIcn2.nodeName, 'IMG', 'Filter icon exists');
- });
-
- test('TableFilter removed', function() {
- tf.remove();
- var fltIcn1 = tf.Cpt.popupFilter.popUpFltImgs[3];
- deepEqual(fltIcn1, undefined, 'Filter icon is removed');
- deepEqual(dom.id(tf.fltIds[3]), null, 'Filter is removed');
- });
-
- test('TableFilter re-initialised', function() {
- tf.init();
- var fltIcn1 = tf.Cpt.popupFilter.popUpFltImgs[3];
- deepEqual(fltIcn1.nodeName, 'IMG', 'Filter icon exists');
- deepEqual(dom.id(tf.fltIds[3]).nodeName, 'SELECT', 'Filter exists');
- });
+var id = function (id){ return document.getElementById(id); };
+var tf = new TableFilter('demo', {
+ base_path: '../dist/tablefilter/',
+ col_2: 'multiple',
+ col_3: 'select',
+ popup_filters: true
+});
+tf.init();
+
+var popupFilter = tf.Cpt.popupFilter;
+module('Sanity checks');
+test('Pop-up filter component', function() {
+ notEqual(popupFilter, null, 'PopupFilter instanciated');
+ deepEqual(popupFilter.popUpFltElms instanceof Array, true, 'Type of popUpFltElms property');
+});
+
+module('UI elements');
+test('Pop-up filter UI elements', function() {
+ var flt1 = id(tf.fltIds[3]);
+ var flt2 = id(tf.fltIds[2]);
+ var fltIcn1 = tf.Cpt.popupFilter.popUpFltImgs[3];
+ var fltIcn2 = tf.Cpt.popupFilter.popUpFltImgs[2];
+ notEqual(flt1, null, 'Filter element exists');
+ notEqual(flt2, null, 'Filter element exists');
+ deepEqual(flt2.hasAttribute('multiple'), true, 'Multiple select exists');
+ deepEqual(fltIcn1.nodeName, 'IMG', 'Filter icon exists');
+ deepEqual(fltIcn2.nodeName, 'IMG', 'Filter icon exists');
+});
+
+test('TableFilter removed', function() {
+ tf.remove();
+ var fltIcn1 = tf.Cpt.popupFilter.popUpFltImgs[3];
+ deepEqual(fltIcn1, undefined, 'Filter icon is removed');
+ deepEqual(id(tf.fltIds[3]), null, 'Filter is removed');
+});
+
+test('TableFilter re-initialised', function() {
+ tf.init();
+ var fltIcn1 = tf.Cpt.popupFilter.popUpFltImgs[3];
+ deepEqual(fltIcn1.nodeName, 'IMG', 'Filter icon exists');
+ deepEqual(id(tf.fltIds[3]).nodeName, 'SELECT', 'Filter exists');
});
diff --git a/test/test-rows-counter.html b/test/test-rows-counter.html
index 32680250..5f19f128 100644
--- a/test/test-rows-counter.html
+++ b/test/test-rows-counter.html
@@ -4,13 +4,7 @@
TableFilter alternate rows tests
-
-
-
+
+
diff --git a/test/test-rows-counter.js b/test/test-rows-counter.js
index 4186f43e..20a8ada6 100644
--- a/test/test-rows-counter.js
+++ b/test/test-rows-counter.js
@@ -1,32 +1,24 @@
-requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){
-
- QUnit.start();
-
- var RowsCounter = require('modules/rowsCounter').RowsCounter;
- var Paging = require('modules/paging').Paging;
-
- var tf = new TableFilter('demo', {
- rows_counter: true
- });
- tf.init();
-
- module('Sanity checks');
- test('RowsCounter component', function() {
- deepEqual(tf.Cpt.rowsCounter instanceof RowsCounter, true, 'RowsCounter type');
- notEqual(tf.Cpt.rowsCounter, null, 'RowsCounter instanciated');
- });
-
- test('RowsCounter component with paging', function() {
- tf.Cpt.paging = new Paging(tf);
- var paging = tf.Cpt.paging;
- paging.addPaging();
- equal(tf.Cpt.rowsCounter.rowsCounterSpan.innerHTML, '1-7 / 7', 'Counter value with paging');
- paging.destroy();
- });
-
- test('RowsCounter component without paging', function() {
- tf.Cpt.rowsCounter.refresh();
- equal(tf.Cpt.rowsCounter.rowsCounterSpan.innerHTML, 7, 'Counter value');
- });
+var tf = new TableFilter('demo', {
+ base_path: '../dist/tablefilter/',
+ rows_counter: true
+});
+tf.init();
+
+module('Sanity checks');
+test('RowsCounter component', function() {
+ notEqual(tf.Cpt.rowsCounter, null, 'RowsCounter instanciated');
+});
+
+test('RowsCounter component with paging', function() {
+ tf.Cpt.paging = new TableFilter.Paging(tf);
+ var paging = tf.Cpt.paging;
+ paging.addPaging();
+ equal(tf.Cpt.rowsCounter.rowsCounterSpan.innerHTML, '1-7 / 7', 'Counter value with paging');
+ paging.destroy();
+});
+
+test('RowsCounter component without paging', function() {
+ tf.Cpt.rowsCounter.refresh();
+ equal(tf.Cpt.rowsCounter.rowsCounterSpan.innerHTML, 7, 'Counter value');
});
diff --git a/test/test-sort-custom-sorter.html b/test/test-sort-custom-sorter.html
index 4fcbcc97..717e40b5 100644
--- a/test/test-sort-custom-sorter.html
+++ b/test/test-sort-custom-sorter.html
@@ -4,13 +4,7 @@
TableFilter sort - custom sorter
-
-
-
+
+
diff --git a/test/test-sort-custom-sorter.js b/test/test-sort-custom-sorter.js
index 2719b04a..d516294e 100644
--- a/test/test-sort-custom-sorter.js
+++ b/test/test-sort-custom-sorter.js
@@ -1,84 +1,74 @@
-requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){
- var types = require('types').Types,
- dom = require('dom').Dom;
+var tag = function (elm, tag){ return elm.getElementsByTagName(tag); };
- var tf = new TableFilter('demo', {
- base_path: '../src/',
- sort: true,
- sort_config: {
- sort_types:[
- 'String',
- 'enforceinteger',
- 'String',
- 'String',
- 'EU',
- 'US',
- 'String',
- 'dmydate',
- 'mdydate'
- ]
- },
- on_sort_loaded: function(tf, sort){
- sort.addSortType('enforceinteger', customIntegerSorter);
- startTest(tf);
- }
+var tf = new TableFilter('demo', {
+ base_path: '../dist/tablefilter/',
+ sort: true,
+ sort_config: {
+ sort_types:[
+ 'String',
+ 'enforceinteger',
+ 'String',
+ 'String',
+ 'EU',
+ 'US',
+ 'String',
+ 'dmydate',
+ 'mdydate'
+ ]
+ },
+ on_sort_loaded: function(tf, sort){
+ sort.addSortType('enforceinteger', customIntegerSorter);
+ startTest(tf, sort);
+ }
+});
+
+//Custom sorter function
+function customIntegerSorter(val){
+ var m = val.match(/\d+/);
+ return parseInt(m[0], 10);
+}
+
+tf.init();
+
+function startTest(tf, sort){
+ module('Sanity checks');
+ test('Sort extension', function() {
+ notEqual(sort, null, 'Sort instanciated');
+ deepEqual(sort.sorted, false, 'Table not sorted');
});
- //Custom sorter function
- function customIntegerSorter(val){
- var m = val.match(/\d+/);
- return parseInt(m[0], 10);
- }
+ module('UI elements');
+ test('Sort UI elements', function() {
+ var th = tf.getHeaderElement(0),
+ indicator = tag(th, 'img'),
+ validRows = tf.getValidRowsIndex(true);
- tf.init();
+ deepEqual(indicator.length, 1, 'Sort indicator in header element');
+ deepEqual(
+ (tf.tbl.rows[validRows[0]].cells[1]).innerHTML,
+ 'AUY78',
+ 'First custom key cell text before sorting');
+ });
- QUnit.start();
+ test('Sort behaviour', function() {
+ var th = tf.getHeaderElement(1),
+ validRows = tf.getValidRowsIndex();
+ sort.sortByColumnIndex(1);
- function startTest(tf){
- var sort = tf.ExtRegistry.sort;
+ deepEqual(sort.sorted, true, 'Table column sorted');
+ deepEqual(
+ (tf.tbl.rows[validRows[0]].cells[1]).innerHTML,
+ 'QT1',
+ 'First custom key cell text after sorting');
+ });
- module('Sanity checks');
- test('Sort extension', function() {
- notEqual(sort, null, 'Sort instanciated');
- deepEqual(sort.stt instanceof SortableTable, true, 'Sort type');
- deepEqual(sort.sorted, false, 'Table not sorted');
- });
-
- module('UI elements');
- test('Sort UI elements', function() {
- var th = tf.getHeaderElement(0),
- indicator = dom.tag(th, 'img'),
- validRows = tf.getValidRowsIndex(true);
-
- deepEqual(indicator.length, 1, 'Sort indicator in header element');
- deepEqual(
- dom.getText(tf.tbl.rows[validRows[0]].cells[1]),
- 'AUY78',
- 'First custom key cell text before sorting');
- });
-
- test('Sort behaviour', function() {
- var th = tf.getHeaderElement(1),
- validRows = tf.getValidRowsIndex();
- sort.sortByColumnIndex(1);
-
- deepEqual(sort.sorted, true, 'Table column sorted');
- deepEqual(
- dom.getText(tf.tbl.rows[validRows[0]].cells[1]),
- 'QT1',
- 'First custom key cell text after sorting');
- });
-
- module('Destroy and re-init');
- test('Remove sort', function() {
- sort.destroy();
- var th = tf.getHeaderElement(0),
- indicator = dom.tag(th, 'img');
- deepEqual(tf.sort, false, 'Sort is removed');
- deepEqual(indicator.length, 0, 'Sort indicator is removed');
- });
-
- }
-
-});
+ module('Destroy and re-init');
+ test('Remove sort', function() {
+ sort.destroy();
+ var th = tf.getHeaderElement(0),
+ indicator = tag(th, 'img');
+ deepEqual(tf.sort, false, 'Sort is removed');
+ deepEqual(indicator.length, 0, 'Sort indicator is removed');
+ });
+}
diff --git a/test/test-status-bar.html b/test/test-status-bar.html
index 6437f3e0..ec4cd616 100644
--- a/test/test-status-bar.html
+++ b/test/test-status-bar.html
@@ -4,13 +4,7 @@
TableFilter status bar
-
-
-
+
+
diff --git a/test/test-store.html b/test/test-store.html
index dd4b9976..9a8dcdca 100644
--- a/test/test-store.html
+++ b/test/test-store.html
@@ -4,13 +4,7 @@
TableFilter store
-
-
-
+
+
diff --git a/test/test.html b/test/test.html
index dbb3fb30..b45f9b51 100644
--- a/test/test.html
+++ b/test/test.html
@@ -4,14 +4,7 @@
TableFilter basic test
-
-
-
-
+
diff --git a/webpack.config.js b/webpack.config.js
index b6d49f19..25f1960c 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,37 +1,95 @@
-var path = require("path");
-var webpack = require("webpack");
+var path = require('path');
+var webpack = require('webpack');
+var Clean = require('clean-webpack-plugin');
module.exports = {
- dev: {
- entry: __dirname + '/src-es6/tablefilter.js',
+ build: {
+ entry: path.join(__dirname, '/src-es6/tablefilter.js'),
output: {
- publicPath: "src/",
- path: __dirname + "/src",
- filename: "[name].js",
- chunkFilename: "[name].js",
+ publicPath: '/build/tablefilter/',
+ path: path.join(__dirname, '/build/tablefilter'),
+ filename: 'tablefilter.js',
+ // chunkFilename: '[name]-[chunkhash].js',
+ chunkFilename: '[name].js',
libraryTarget: 'umd'
},
resolve: {
- extensions: ['', '.js']
+ extensions: ['', '.js'],
+ alias: {
+ sortabletable: '../../../libs/sortabletable.js'
+ }
},
module: {
loaders: [{
test: path.join(__dirname, 'src-es6'),
+ exclude: /node_modules/,
+ query: {
+ compact: false
+ },
loader: 'babel-loader'
}]
- }
+ },
+ plugins: [
+ // new webpack.DefinePlugin({
+ // 'process.env': {
+ // // This has effect on the react lib size
+ // 'NODE_ENV': JSON.stringify('production')
+ // }
+ // }),
+ new Clean(['build']),
+ new webpack.optimize.DedupePlugin()
+ ],
+ devtool: 'source-map',
+ debug: true
},
- build: {
- entry: __dirname + '/src/tablefilter.js',
+ dist: {
+ entry: path.join(__dirname, '/src-es6/tablefilter.js'),
+ // entry: {
+ // tablefilter: __dirname + '/src-es6/tablefilter.js',
+ // sortabletable: __dirname + '/libs/sortabletable.js'
+ // },
output: {
- publicPath: "dist/",
- path: __dirname + "/dist",
- filename: "[name].js",
- chunkFilename: "[name].js",
- libraryTarget: 'this'
+ publicPath: '/dist/tablefilter/',
+ path: path.join(__dirname, '/dist/tablefilter'),
+ filename: 'tablefilter.js',
+ // chunkFilename: '[name]-[chunkhash].js',
+ chunkFilename: '[name].js',
+ libraryTarget: 'umd'
},
resolve: {
- extensions: ['', '.js']
- }
+ extensions: ['', '.js'],
+ alias: {
+ sortabletable: '../../../libs/sortabletable.js'
+ // ,
+ // adapterSortabletable:
+ // './extensions/sortabletable/adapterSortabletable'
+ }
+ },
+ // externals: {
+ // 'sortabletable': 'SortableTable'
+ // },
+ module: {
+ loaders: [{
+ test: path.join(__dirname, 'src-es6'),
+ exclude: /node_modules/,
+ query: {
+ compact: false
+ },
+ loader: 'babel-loader'
+ }]
+ },
+ plugins: [
+ // new webpack.DefinePlugin({
+ // 'process.env': {
+ // // This has effect on the react lib size
+ // 'NODE_ENV': JSON.stringify('production')
+ // }
+ // }),
+ // new webpack.IgnorePlugin(/adapterSortabletable$/),
+ new Clean(['dist']),
+ new webpack.optimize.DedupePlugin(),
+ new webpack.optimize.MinChunkSizePlugin({ minChunkSize: 10000 }),
+ new webpack.optimize.UglifyJsPlugin()
+ ]
}
};