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