mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-06-16 12:45:49 +02:00
Added es-6 modules
This commit is contained in:
parent
5a3a989af0
commit
1b3f91a32c
|
@ -7,6 +7,7 @@
|
|||
"-W061": true,
|
||||
"-W041": true,
|
||||
"curly": true,
|
||||
//"indent": 4,
|
||||
//"eqeqeq": true,
|
||||
"es3": true,
|
||||
"esnext": true,
|
||||
|
|
2
dist/filtergrid.css
vendored
2
dist/filtergrid.css
vendored
|
@ -1,6 +1,6 @@
|
|||
/*------------------------------------------------------------------------
|
||||
- TableFilter stylesheet by Max Guglielmi
|
||||
- (build date: Sun Nov 16 2014 10:15:56)
|
||||
- (build date: Sun Nov 16 2014 12:22:04)
|
||||
- Edit below for your projects' needs
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -15,77 +15,76 @@ export class Loader{
|
|||
// TableFilter configuration
|
||||
var f = tf.fObj;
|
||||
//id of container element
|
||||
tf.loaderTgtId = f.loader_target_id || null;
|
||||
this.loaderTgtId = f.loader_target_id || null;
|
||||
//div containing loader
|
||||
tf.loaderDiv = null;
|
||||
this.loaderDiv = null;
|
||||
//defines loader text
|
||||
tf.loaderText = f.loader_text || 'Loading...';
|
||||
this.loaderText = f.loader_text || 'Loading...';
|
||||
//defines loader innerHtml
|
||||
tf.loaderHtml = f.loader_html || null;
|
||||
this.loaderHtml = f.loader_html || null;
|
||||
//defines css class for loader div
|
||||
tf.loaderCssClass = f.loader_css_class || 'loader';
|
||||
this.loaderCssClass = f.loader_css_class || 'loader';
|
||||
//delay for hiding loader
|
||||
tf.loaderCloseDelay = 200;
|
||||
this.loaderCloseDelay = 200;
|
||||
//callback function before loader is displayed
|
||||
tf.onShowLoader = Types.isFn(f.on_show_loader) ?
|
||||
this.onShowLoader = Types.isFn(f.on_show_loader) ?
|
||||
f.on_show_loader : null;
|
||||
//callback function after loader is closed
|
||||
tf.onHideLoader = Types.isFn(f.on_hide_loader) ?
|
||||
this.onHideLoader = Types.isFn(f.on_hide_loader) ?
|
||||
f.on_hide_loader : null;
|
||||
|
||||
this.tf = tf;
|
||||
|
||||
var containerDiv = Dom.create('div', ['id', tf.prfxLoader+tf.id]);
|
||||
containerDiv.className = tf.loaderCssClass;
|
||||
containerDiv.className = this.loaderCssClass;
|
||||
|
||||
var targetEl = !tf.loaderTgtId ?
|
||||
var targetEl = !this.loaderTgtId ?
|
||||
(tf.gridLayout ? tf.tblCont : tf.tbl.parentNode) :
|
||||
Dom.id(tf.loaderTgtId);
|
||||
if(!tf.loaderTgtId){
|
||||
Dom.id(this.loaderTgtId);
|
||||
if(!this.loaderTgtId){
|
||||
targetEl.insertBefore(containerDiv, tf.tbl);
|
||||
} else {
|
||||
targetEl.appendChild(containerDiv);
|
||||
}
|
||||
tf.loaderDiv = Dom.id(tf.prfxLoader+tf.id);
|
||||
if(!tf.loaderHtml){
|
||||
tf.loaderDiv.appendChild(Dom.text(tf.loaderText));
|
||||
this.loaderDiv = Dom.id(tf.prfxLoader+tf.id);
|
||||
if(!this.loaderHtml){
|
||||
this.loaderDiv.appendChild(Dom.text(this.loaderText));
|
||||
} else {
|
||||
tf.loaderDiv.innerHTML = tf.loaderHtml;
|
||||
this.loaderDiv.innerHTML = this.loaderHtml;
|
||||
}
|
||||
}
|
||||
|
||||
show(p) {
|
||||
if(!this.tf.loader || !this.tf.loaderDiv ||
|
||||
this.tf.loaderDiv.style.display===p){
|
||||
if(!this.tf.loader || !this.loaderDiv ||
|
||||
this.loaderDiv.style.display===p){
|
||||
return;
|
||||
}
|
||||
var o = this.tf;
|
||||
|
||||
function displayLoader(){
|
||||
if(!o.loaderDiv){
|
||||
var displayLoader = () => {
|
||||
if(!this.loaderDiv){
|
||||
return;
|
||||
}
|
||||
if(o.onShowLoader && p!=='none'){
|
||||
o.onShowLoader.call(null, o);
|
||||
}
|
||||
o.loaderDiv.style.display = p;
|
||||
if(o.onHideLoader && p==='none'){
|
||||
o.onHideLoader.call(null, o);
|
||||
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.tf.loaderCloseDelay : 1;
|
||||
var t = p==='none' ? this.loaderCloseDelay : 1;
|
||||
global.setTimeout(displayLoader, t);
|
||||
}
|
||||
|
||||
remove(){
|
||||
if(!this.tf.loaderDiv){
|
||||
if(!this.loaderDiv){
|
||||
return;
|
||||
}
|
||||
var targetEl = !this.tf.loaderTgtId ?
|
||||
var targetEl = !this.loaderTgtId ?
|
||||
(this.tf.gridLayout ? this.tf.tblCont : this.tf.tbl.parentNode):
|
||||
Dom.id(this.tf.loaderTgtId);
|
||||
targetEl.removeChild(this.tf.loaderDiv);
|
||||
this.tf.loaderDiv = null;
|
||||
Dom.id(this.loaderTgtId);
|
||||
targetEl.removeChild(this.loaderDiv);
|
||||
this.loaderDiv = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import {Types} from '../types';
|
|||
import {Helpers} from '../helpers';
|
||||
|
||||
export class RowsCounter{
|
||||
|
||||
/**
|
||||
* Rows counter
|
||||
* @param {Object} tf TableFilter instance
|
||||
|
@ -24,8 +25,7 @@ export class RowsCounter{
|
|||
//defines css class rows counter
|
||||
this.totRowsCssClass = f.tot_rows_css_class || 'tot';
|
||||
//callback raised before counter is refreshed
|
||||
this.onBeforeRefreshCounter =
|
||||
Types.isFn(f.on_before_refresh_counter) ?
|
||||
this.onBeforeRefreshCounter = Types.isFn(f.on_before_refresh_counter) ?
|
||||
f.on_before_refresh_counter : null;
|
||||
//callback raised after counter is refreshed
|
||||
this.onAfterRefreshCounter = Types.isFn(f.on_after_refresh_counter) ?
|
||||
|
|
71
src/core.js
71
src/core.js
|
@ -835,7 +835,8 @@ function TableFilter(id) {
|
|||
/*====================================================
|
||||
- onchange event for select filters
|
||||
=====================================================*/
|
||||
_OnSlcChange: function(e) {
|
||||
_OnSlcChange: function(e) {console.log(o, o.activeFlt);
|
||||
if(!o.activeFlt){ return; }
|
||||
var colIndex = o.activeFlt.getAttribute('colIndex');
|
||||
//Checks filter is a checklist and caller is not null
|
||||
if(o.activeFlt && colIndex &&
|
||||
|
@ -1096,14 +1097,14 @@ TableFilter.prototype = {
|
|||
select is disabled and by clicking on element
|
||||
(parent td), users enable drop-down and select is
|
||||
populated at same time. */
|
||||
if(this.fillSlcOnDemand && hlp.isIE()){
|
||||
slc.disabled = true;
|
||||
slc.title = this.activateSlcTooltip;
|
||||
slc.parentNode.onclick = this.Evt._EnableSlc;
|
||||
if(col===this.fltTypeMulti){
|
||||
this.__deferMultipleSelection(slc,0);
|
||||
}
|
||||
}
|
||||
// if(this.fillSlcOnDemand && hlp.isIE()){
|
||||
// slc.disabled = true;
|
||||
// slc.title = this.activateSlcTooltip;
|
||||
// slc.parentNode.onclick = this.Evt._EnableSlc;
|
||||
// if(col===this.fltTypeMulti){
|
||||
// this.__deferMultipleSelection(slc,0);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// checklist
|
||||
else if(col===this.fltTypeCheckList){
|
||||
|
@ -3415,9 +3416,9 @@ TableFilter.prototype = {
|
|||
li0.style.display = 'none';
|
||||
}
|
||||
//IE: label looses check capability
|
||||
if(hlp.isIE()){
|
||||
li0.label.onclick = function(){ li0.check.click(); };
|
||||
}
|
||||
// if(hlp.isIE()){
|
||||
// li0.label.onclick = function(){ li0.check.click(); };
|
||||
// }
|
||||
|
||||
if(o.enableEmptyOption){
|
||||
var li1 = dom.createCheckItem(
|
||||
|
@ -3429,9 +3430,9 @@ TableFilter.prototype = {
|
|||
ul.onchange.call(null, e);
|
||||
};
|
||||
//IE: label looses check capability
|
||||
if(hlp.isIE()){
|
||||
li1.label.onclick = function(){ li1.check.click(); };
|
||||
}
|
||||
// if(hlp.isIE()){
|
||||
// li1.label.onclick = function(){ li1.check.click(); };
|
||||
// }
|
||||
chkCt++;
|
||||
}
|
||||
|
||||
|
@ -3448,10 +3449,10 @@ TableFilter.prototype = {
|
|||
ul.onchange.call(null, e);
|
||||
};
|
||||
//IE: label looses check capability
|
||||
if(hlp.isIE())
|
||||
{
|
||||
li2.label.onclick = function(){ li2.check.click(); };
|
||||
}
|
||||
// if(hlp.isIE())
|
||||
// {
|
||||
// li2.label.onclick = function(){ li2.check.click(); };
|
||||
// }
|
||||
chkCt++;
|
||||
}
|
||||
return chkCt;
|
||||
|
@ -3511,9 +3512,9 @@ TableFilter.prototype = {
|
|||
}
|
||||
}
|
||||
//IE: label looses check capability
|
||||
if(hlp.isIE()){
|
||||
li.label.onclick = labelClick;
|
||||
}
|
||||
// if(hlp.isIE()){
|
||||
// li.label.onclick = labelClick;
|
||||
// }
|
||||
}
|
||||
function labelClick(){
|
||||
this.firstChild.click();
|
||||
|
@ -3527,19 +3528,19 @@ TableFilter.prototype = {
|
|||
flt.setAttribute('filled','1');
|
||||
|
||||
/*** remember grid values IE only, items remain un-checked ***/
|
||||
if(o.rememberGridValues && hlp.isIE()){
|
||||
var slcIndexes = ul.getAttribute('indexes');
|
||||
if(slcIndexes){
|
||||
var indSplit = slcIndexes.split(',');//items indexes
|
||||
for(var n=0; n<indSplit.length; n++){
|
||||
//checked item
|
||||
var cChk = dom.id(this.fltIds[colIndex]+'_'+indSplit[n]);
|
||||
if(cChk){
|
||||
cChk.checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(o.rememberGridValues && hlp.isIE()){
|
||||
// var slcIndexes = ul.getAttribute('indexes');
|
||||
// if(slcIndexes){
|
||||
// var indSplit = slcIndexes.split(',');//items indexes
|
||||
// for(var n=0; n<indSplit.length; n++){
|
||||
// //checked item
|
||||
// var cChk = dom.id(this.fltIds[colIndex]+'_'+indSplit[n]);
|
||||
// if(cChk){
|
||||
// cChk.checked = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
},
|
||||
|
||||
/*====================================================
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
base_path: './',
|
||||
rows_counter: true,
|
||||
enable_default_theme: true,
|
||||
paging: true,
|
||||
paging: false,
|
||||
alternate_rows: true,
|
||||
highlight_keywords: true,
|
||||
match_case: false,
|
||||
|
|
|
@ -17,38 +17,38 @@ define(["exports", "../dom", "../types"], function (exports, _dom, _types) {
|
|||
// TableFilter configuration
|
||||
var f = tf.fObj;
|
||||
//id of container element
|
||||
tf.loaderTgtId = f.loader_target_id || null;
|
||||
this.loaderTgtId = f.loader_target_id || null;
|
||||
//div containing loader
|
||||
tf.loaderDiv = null;
|
||||
this.loaderDiv = null;
|
||||
//defines loader text
|
||||
tf.loaderText = f.loader_text || "Loading...";
|
||||
this.loaderText = f.loader_text || "Loading...";
|
||||
//defines loader innerHtml
|
||||
tf.loaderHtml = f.loader_html || null;
|
||||
this.loaderHtml = f.loader_html || null;
|
||||
//defines css class for loader div
|
||||
tf.loaderCssClass = f.loader_css_class || "loader";
|
||||
this.loaderCssClass = f.loader_css_class || "loader";
|
||||
//delay for hiding loader
|
||||
tf.loaderCloseDelay = 200;
|
||||
this.loaderCloseDelay = 200;
|
||||
//callback function before loader is displayed
|
||||
tf.onShowLoader = Types.isFn(f.on_show_loader) ? f.on_show_loader : null;
|
||||
this.onShowLoader = Types.isFn(f.on_show_loader) ? f.on_show_loader : null;
|
||||
//callback function after loader is closed
|
||||
tf.onHideLoader = Types.isFn(f.on_hide_loader) ? f.on_hide_loader : null;
|
||||
this.onHideLoader = Types.isFn(f.on_hide_loader) ? f.on_hide_loader : null;
|
||||
|
||||
this.tf = tf;
|
||||
|
||||
var containerDiv = Dom.create("div", ["id", tf.prfxLoader + tf.id]);
|
||||
containerDiv.className = tf.loaderCssClass;
|
||||
containerDiv.className = this.loaderCssClass;
|
||||
|
||||
var targetEl = !tf.loaderTgtId ? (tf.gridLayout ? tf.tblCont : tf.tbl.parentNode) : Dom.id(tf.loaderTgtId);
|
||||
if (!tf.loaderTgtId) {
|
||||
var targetEl = !this.loaderTgtId ? (tf.gridLayout ? tf.tblCont : tf.tbl.parentNode) : Dom.id(this.loaderTgtId);
|
||||
if (!this.loaderTgtId) {
|
||||
targetEl.insertBefore(containerDiv, tf.tbl);
|
||||
} else {
|
||||
targetEl.appendChild(containerDiv);
|
||||
}
|
||||
tf.loaderDiv = Dom.id(tf.prfxLoader + tf.id);
|
||||
if (!tf.loaderHtml) {
|
||||
tf.loaderDiv.appendChild(Dom.text(tf.loaderText));
|
||||
this.loaderDiv = Dom.id(tf.prfxLoader + tf.id);
|
||||
if (!this.loaderHtml) {
|
||||
this.loaderDiv.appendChild(Dom.text(this.loaderText));
|
||||
} else {
|
||||
tf.loaderDiv.innerHTML = tf.loaderHtml;
|
||||
this.loaderDiv.innerHTML = this.loaderHtml;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -56,37 +56,37 @@ define(["exports", "../dom", "../types"], function (exports, _dom, _types) {
|
|||
show: {
|
||||
writable: true,
|
||||
value: function (p) {
|
||||
if (!this.tf.loader || !this.tf.loaderDiv || this.tf.loaderDiv.style.display === p) {
|
||||
var _this = this;
|
||||
if (!this.tf.loader || !this.loaderDiv || this.loaderDiv.style.display === p) {
|
||||
return;
|
||||
}
|
||||
var o = this.tf;
|
||||
|
||||
function displayLoader() {
|
||||
if (!o.loaderDiv) {
|
||||
var displayLoader = function () {
|
||||
if (!_this.loaderDiv) {
|
||||
return;
|
||||
}
|
||||
if (o.onShowLoader && p !== "none") {
|
||||
o.onShowLoader.call(null, o);
|
||||
}
|
||||
o.loaderDiv.style.display = p;
|
||||
if (o.onHideLoader && p === "none") {
|
||||
o.onHideLoader.call(null, o);
|
||||
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.tf.loaderCloseDelay : 1;
|
||||
var t = p === "none" ? this.loaderCloseDelay : 1;
|
||||
global.setTimeout(displayLoader, t);
|
||||
}
|
||||
},
|
||||
remove: {
|
||||
writable: true,
|
||||
value: function () {
|
||||
if (!this.tf.loaderDiv) {
|
||||
if (!this.loaderDiv) {
|
||||
return;
|
||||
}
|
||||
var targetEl = !this.tf.loaderTgtId ? (this.tf.gridLayout ? this.tf.tblCont : this.tf.tbl.parentNode) : Dom.id(this.tf.loaderTgtId);
|
||||
targetEl.removeChild(this.tf.loaderDiv);
|
||||
this.tf.loaderDiv = null;
|
||||
var targetEl = !this.loaderTgtId ? (this.tf.gridLayout ? this.tf.tblCont : this.tf.tbl.parentNode) : Dom.id(this.loaderTgtId);
|
||||
targetEl.removeChild(this.loaderDiv);
|
||||
this.loaderDiv = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue