1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-08 17:36:42 +02:00

Assigned empty function to callbacks

This commit is contained in:
Max Guglielmi 2016-12-22 22:01:59 +11:00
parent 8af59ef676
commit c75fbe169c
21 changed files with 136 additions and 172 deletions

4
dist/starter.html vendored
View file

@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.4.24 - Starter</title>
<title>tablefilter v0.4.25 - Starter</title>
</head>
<body>
<h1>tablefilter v0.4.24</h1>
<h1>tablefilter v0.4.25</h1>

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.4.24 by Max Guglielmi
* build date: 2016-12-21T09:48:14.169Z
* tablefilter v0.4.25 by Max Guglielmi
* build date: 2016-12-22T10:53:57.629Z
* MIT License
*/
span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.4.24 by Max Guglielmi
* build date: 2016-12-21T09:48:14.169Z
* tablefilter v0.4.25 by Max Guglielmi
* build date: 2016-12-22T10:53:57.629Z
* MIT License
*/
span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.4.24 by Max Guglielmi
* build date: 2016-12-21T09:48:14.169Z
* tablefilter v0.4.25 by Max Guglielmi
* build date: 2016-12-22T10:53:57.629Z
* MIT License
*/
.activeHeader{background-color:#66afe9 !important;color:#fff !important}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.4.24 by Max Guglielmi
* build date: 2016-12-21T09:48:14.169Z
* tablefilter v0.4.25 by Max Guglielmi
* build date: 2016-12-22T10:53:57.629Z
* MIT License
*/
table.TF{border-left:1px solid #ccc;border-top:none;border-right:none;border-bottom:none;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x;border-bottom:1px solid #d0d0d0;border-right:1px solid #d0d0d0;border-left:1px solid #fff;border-top:1px solid #fff;color:#333}table.TF td{border-bottom:1px dotted #999;padding:5px}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.activeHeader{background:#999 !important}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.4.24 by Max Guglielmi
* build date: 2016-12-21T09:48:14.169Z
* tablefilter v0.4.25 by Max Guglielmi
* build date: 2016-12-22T10:53:57.629Z
* MIT License
*/
table.TF{border-left:1px dotted #81963b;border-top:none;border-right:0;border-bottom:none;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x;border-bottom:0;border-right:1px dotted #d0d0d0;border-left:0;border-top:0;color:#fff}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.activeHeader{background:#81963b !important}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.4.24 by Max Guglielmi
* build date: 2016-12-21T09:48:14.169Z
* tablefilter v0.4.25 by Max Guglielmi
* build date: 2016-12-22T10:53:57.629Z
* MIT License
*/
table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.4.24 by Max Guglielmi
* build date: 2016-12-21T09:48:14.169Z
* tablefilter v0.4.25 by Max Guglielmi
* build date: 2016-12-22T10:53:57.629Z
* MIT License
*/
table.TF{padding:0;color:inherit;border-right:1px solid transparent;border-top:1px solid transparent;border-left:1px solid transparent;border-bottom:0;}table.TF th{margin:0;color:inherit;background-color:transparent;border-color:transparent;border-width:1px;border-style:solid;}table.TF th:last-child{border-right:1px solid transparent}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid transparent;border-left:0;border-top:0;border-right:0}.fltrow{background-color:transparent;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px;border-bottom:1px solid transparent !important;}.fltrow th:last-child,.fltrow td:last-child{border-right:1px solid transparent}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4}input.flt{width:99% !important}.inf{background-color:transparent;border:1px solid transparent;height:$min-height;color:inherit}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#f7f7f7 url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#f7f7f7 url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#f7f7f7 url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#f7f7f7 url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.activeHeader{background:#f7f7f7 !important;border:1px solid transparent;color:inherit !important}div.grd_Cont{-webkit-box-shadow:0 0 0 0 rgba(50,50,50,0.75);-moz-box-shadow:0 0 0 0 rgba(50,50,50,0.75);box-shadow:0 0 0 0 rgba(50,50,50,0.75);background-color:transparent;border:1px solid transparent;padding:0 !important;}div.grd_Cont .even{background-color:transparent}div.grd_Cont .odd{background-color:#f7f7f7}div.grd_headTblCont{background-color:transparent;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:transparent;border-bottom:1px solid transparent;border-right:1px solid transparent !important;border-left:1px solid transparent;border-top:1px solid transparent}div.grd_tblCont table td{border-bottom:1px solid transparent;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:transparent;color:inherit;border-top:1px solid transparent;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#f7f7f7;border:1px solid #f7f7f7;border-radius:5px;color:#000;text-shadow:none}.even{background-color:transparent}.odd{background-color:#f7f7f7}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ccc !important;color:inherit}.ezSelectedRow{background-color:#ccc !important;color:inherit}.ezActiveCell{background-color:transparent;color:inherit;font-weight:bold}.ezETSelectedCell{background-color:transparent;font-weight:bold;color:inherit}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "tablefilter",
"version": "0.4.24",
"version": "0.4.25",
"description": "A Javascript library making HTML tables filterable and a bit more",
"license": "MIT",
"author": {

View file

@ -1,6 +1,6 @@
import {Feature} from '../../feature';
import {createText, elm} from '../../dom';
import {isArray, isFn, isUndef} from '../../types';
import {isArray, isFn, isUndef, EMPTY_FN} from '../../types';
const EVENTS = [
'after-filtering',
@ -27,14 +27,14 @@ export default class ColOps extends Feature {
* @type {Function}
*/
this.onBeforeOperation = isFn(opts.on_before_operation) ?
opts.on_before_operation : null;
opts.on_before_operation : EMPTY_FN;
/**
* Callback fired after columns operations are completed
* @type {Function}
*/
this.onAfterOperation = isFn(opts.on_after_operation) ?
opts.on_after_operation : null;
opts.on_after_operation : EMPTY_FN;
/**
* Configuration options
@ -85,9 +85,7 @@ export default class ColOps extends Feature {
return;
}
if (this.onBeforeOperation) {
this.onBeforeOperation.call(null, tf, this);
}
this.onBeforeOperation(tf, this);
this.emitter.emit('before-column-operation', tf, this);
let opts = this.opts,
@ -348,9 +346,7 @@ export default class ColOps extends Feature {
}//for ucol
}//if typeof
if (this.onAfterOperation) {
this.onAfterOperation.call(null, tf, this);
}
this.onAfterOperation(tf, this);
this.emitter.emit('after-column-operation', tf, this);
}

View file

@ -3,7 +3,7 @@ import {
addClass, removeClass, createCheckItem, createElm, elm, removeElm,
getText
} from '../../dom';
import {isFn} from '../../types';
import {isFn, EMPTY_FN} from '../../types';
import {addEvt, targetEvt} from '../../event';
/**
@ -209,59 +209,62 @@ export default class ColsVisibility extends Feature {
* Callback fired when the extension is initialized
* @type {Function}
*/
this.onLoaded = isFn(f.on_loaded) ? f.on_loaded : null;
this.onLoaded = isFn(f.on_loaded) ? f.on_loaded : EMPTY_FN;
/**
* Callback fired before the columns manager is opened
* @type {Function}
*/
this.onBeforeOpen = isFn(f.on_before_open) ? f.on_before_open : null;
this.onBeforeOpen = isFn(f.on_before_open) ?
f.on_before_open : EMPTY_FN;
/**
* Callback fired after the columns manager is opened
* @type {Function}
*/
this.onAfterOpen = isFn(f.on_after_open) ? f.on_after_open : null;
this.onAfterOpen = isFn(f.on_after_open) ? f.on_after_open : EMPTY_FN;
/**
* Callback fired before the columns manager is closed
* @type {Function}
*/
this.onBeforeClose = isFn(f.on_before_close) ? f.on_before_close : null;
this.onBeforeClose = isFn(f.on_before_close) ?
f.on_before_close : EMPTY_FN;
/**
* Callback fired after the columns manager is closed
* @type {Function}
*/
this.onAfterClose = isFn(f.on_after_close) ? f.on_after_close : null;
this.onAfterClose = isFn(f.on_after_close) ?
f.on_after_close : EMPTY_FN;
/**
* Callback fired before a column is hidden
* @type {Function}
*/
this.onBeforeColHidden = isFn(f.on_before_col_hidden) ?
f.on_before_col_hidden : null;
f.on_before_col_hidden : EMPTY_FN;
/**
* Callback fired after a column is hidden
* @type {Function}
*/
this.onAfterColHidden = isFn(f.on_after_col_hidden) ?
f.on_after_col_hidden : null;
f.on_after_col_hidden : EMPTY_FN;
/**
* Callback fired before a column is displayed
* @type {Function}
*/
this.onBeforeColDisplayed = isFn(f.on_before_col_displayed) ?
f.on_before_col_displayed : null;
f.on_before_col_displayed : EMPTY_FN;
/**
* Callback fired after a column is displayed
* @type {Function}
*/
this.onAfterColDisplayed = isFn(f.on_after_col_displayed) ?
f.on_after_col_displayed : null;
f.on_after_col_displayed : EMPTY_FN;
//Grid layout support
if (tf.gridLayout) {
@ -283,26 +286,22 @@ export default class ColsVisibility extends Feature {
*/
toggle() {
let contDisplay = this.contEl.style.display;
let onBeforeOpen = this.onBeforeOpen;
let onBeforeClose = this.onBeforeClose;
let onAfterOpen = this.onAfterOpen;
let onAfterClose = this.onAfterClose;
if (onBeforeOpen && contDisplay !== 'inline') {
onBeforeOpen.call(null, this);
if (contDisplay !== 'inline') {
this.onBeforeOpen(this);
}
if (onBeforeClose && contDisplay === 'inline') {
onBeforeClose.call(null, this);
if (contDisplay === 'inline') {
this.onBeforeClose(this);
}
this.contEl.style.display = contDisplay === 'inline' ?
'none' : 'inline';
if (onAfterOpen && contDisplay !== 'inline') {
onAfterOpen.call(null, this);
if (contDisplay !== 'inline') {
this.onAfterOpen(this);
}
if (onAfterClose && contDisplay === 'inline') {
onAfterClose.call(null, this);
if (contDisplay === 'inline') {
this.onAfterClose(this);
}
}
@ -407,9 +406,7 @@ export default class ColsVisibility extends Feature {
this.spanEl = span;
this.btnEl = this.spanEl.firstChild;
if (this.onLoaded) {
this.onLoaded.call(null, this);
}
this.onLoaded(this);
}
/**
@ -510,11 +507,11 @@ export default class ColsVisibility extends Feature {
let tf = this.tf;
let tbl = tf.tbl;
if (this.onBeforeColHidden && hide) {
this.onBeforeColHidden.call(null, this, colIndex);
if (hide) {
this.onBeforeColHidden(this, colIndex);
}
if (this.onBeforeColDisplayed && !hide) {
this.onBeforeColDisplayed.call(null, this, colIndex);
if (!hide) {
this.onBeforeColDisplayed(this, colIndex);
}
this._hideCells(tbl, colIndex, hide);
@ -553,9 +550,8 @@ export default class ColsVisibility extends Feature {
headTbl.style.width = headTblW - hiddenWidth + 'px';
tbl.style.width = headTbl.style.width;
}
if (this.onAfterColHidden) {
this.onAfterColHidden.call(null, this, colIndex);
}
this.onAfterColHidden(this, colIndex);
this.emitter.emit('column-hidden', tf, this, colIndex,
this.hiddenCols);
}
@ -574,9 +570,8 @@ export default class ColsVisibility extends Feature {
(parseInt(headTbl.style.width, 10) + width) + 'px';
tf.tbl.style.width = headTbl.style.width;
}
if (this.onAfterColDisplayed) {
this.onAfterColDisplayed.call(null, this, colIndex);
}
this.onAfterColDisplayed(this, colIndex);
this.emitter.emit('column-shown', tf, this, colIndex,
this.hiddenCols);
}

View file

@ -1,6 +1,6 @@
import {Feature} from '../../feature';
import {createElm, removeElm, elm} from '../../dom';
import {isFn, isUndef} from '../../types';
import {isFn, isUndef, EMPTY_FN} from '../../types';
import {addEvt} from '../../event';
/**
@ -148,25 +148,27 @@ export default class FiltersVisibility extends Feature {
* Callback fired before filters row is shown
* @type {Function}
*/
this.onBeforeShow = isFn(f.on_before_show) ? f.on_before_show : null;
this.onBeforeShow = isFn(f.on_before_show) ?
f.on_before_show : EMPTY_FN;
/**
* Callback fired after filters row is shown
* @type {Function}
*/
this.onAfterShow = isFn(f.on_after_show) ? f.on_after_show : null;
this.onAfterShow = isFn(f.on_after_show) ? f.on_after_show : EMPTY_FN;
/**
* Callback fired before filters row is hidden
* @type {Function}
*/
this.onBeforeHide = isFn(f.on_before_hide) ? f.on_before_hide : null;
this.onBeforeHide = isFn(f.on_before_hide) ?
f.on_before_hide : EMPTY_FN;
/**
* Callback fired after filters row is hidden
* @type {Function}
*/
this.onAfterHide = isFn(f.on_after_hide) ? f.on_after_hide : null;
this.onAfterHide = isFn(f.on_after_hide) ? f.on_after_hide : EMPTY_FN;
//Import extension's stylesheet
tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null,
@ -259,11 +261,11 @@ export default class FiltersVisibility extends Feature {
let tbl = tf.gridLayout ? tf.feature('gridLayout').headTbl : tf.tbl;
let fltRow = tbl.rows[this.filtersRowIndex];
if (this.onBeforeShow && visible) {
this.onBeforeShow.call(this, this);
if (visible) {
this.onBeforeShow(this);
}
if (this.onBeforeHide && !visible) {
this.onBeforeHide.call(null, this);
if (!visible) {
this.onBeforeHide(this);
}
fltRow.style.display = visible ? '' : 'none';
@ -272,11 +274,11 @@ export default class FiltersVisibility extends Feature {
this.collapseBtnHtml : this.expandBtnHtml;
}
if (this.onAfterShow && visible) {
this.onAfterShow.call(null, this);
if (visible) {
this.onAfterShow(this);
}
if (this.onAfterHide && !visible) {
this.onAfterHide.call(null, this);
if (!visible) {
this.onAfterHide(this);
}
this.emitter.emit('filters-toggled', tf, this, visible);

View file

@ -1,5 +1,5 @@
import {Feature} from '../../feature';
import {isArray, isFn, isUndef, isObj} from '../../types';
import {isArray, isFn, isUndef, isObj, EMPTY_FN} from '../../types';
import {createElm, elm, getText, tag} from '../../dom';
import {addEvt} from '../../event';
import {parse as parseNb} from '../../number';
@ -109,20 +109,21 @@ export default class AdapterSortableTable extends Feature {
* @type {Function}
*/
this.onSortLoaded = isFn(opts.on_sort_loaded) ?
opts.on_sort_loaded : null;
opts.on_sort_loaded : EMPTY_FN;
/**
* Callback fired before a table column is sorted
* @type {Function}
*/
this.onBeforeSort = isFn(opts.on_before_sort) ?
opts.on_before_sort : null;
opts.on_before_sort : EMPTY_FN;
/**
* Callback fired after a table column is sorted
* @type {Function}
*/
this.onAfterSort = isFn(opts.on_after_sort) ? opts.on_after_sort : null;
this.onAfterSort = isFn(opts.on_after_sort) ?
opts.on_after_sort : EMPTY_FN;
/**
* SortableTable instance
@ -154,15 +155,11 @@ export default class AdapterSortableTable extends Feature {
this.overrideSortableTable();
this.setSortTypes();
if (this.onSortLoaded) {
this.onSortLoaded.call(null, tf, this);
}
this.onSortLoaded(tf, this);
/*** SortableTable callbacks ***/
this.stt.onbeforesort = function () {
if (adpt.onBeforeSort) {
adpt.onBeforeSort.call(null, tf, adpt.stt.sortColumn);
}
adpt.onBeforeSort(tf, adpt.stt.sortColumn);
/*** sort behaviour for paging ***/
if (tf.paging) {
@ -182,11 +179,7 @@ export default class AdapterSortableTable extends Feature {
paginator.setPage(paginator.getPage());
}
if (adpt.onAfterSort) {
adpt.onAfterSort.call(null, tf, adpt.stt.sortColumn,
adpt.stt.descending);
}
adpt.onAfterSort(tf, adpt.stt.sortColumn, adpt.stt.descending);
adpt.emitter.emit('column-sorted', tf, adpt.stt.sortColumn,
adpt.stt.descending);
};

View file

@ -1,6 +1,6 @@
import {Feature} from '../feature';
import {createElm, createText, elm, removeElm} from '../dom';
import {isFn} from '../types';
import {isFn, EMPTY_FN} from '../types';
import {root} from '../root';
import {NONE} from '../const';
@ -75,13 +75,14 @@ export class Loader extends Feature {
* Callback fired when loader is displayed
* @type {Function}
*/
this.onShow = isFn(f.on_show_loader) ? f.on_show_loader : null;
this.onShow = isFn(f.on_show_loader) ?
f.on_show_loader : EMPTY_FN;
/**
* Callback fired when loader is closed
* @type {Function}
*/
this.onHide = isFn(f.on_hide_loader) ? f.on_hide_loader : null;
this.onHide = isFn(f.on_hide_loader) ? f.on_hide_loader : EMPTY_FN;
}
/**
@ -137,12 +138,12 @@ export class Loader extends Feature {
if (!this.cont) {
return;
}
if (this.onShow && p !== NONE) {
this.onShow.call(null, this);
if (p !== NONE) {
this.onShow(this);
}
this.cont.style.display = p;
if (this.onHide && p === NONE) {
this.onHide.call(null, this);
if (p === NONE) {
this.onHide(this);
}
};

View file

@ -1,6 +1,6 @@
import {Feature} from '../feature';
import {createElm, elm, removeElm} from '../dom';
import {isEmpty, isFn} from '../types';
import {isEmpty, isFn, EMPTY_FN} from '../types';
import {NONE} from '../const';
/**
@ -64,28 +64,28 @@ export class NoResults extends Feature {
* @type {Function}
*/
this.onBeforeShow = isFn(f.on_before_show_msg) ?
f.on_before_show_msg : null;
f.on_before_show_msg : EMPTY_FN;
/**
* Callback fired after the message is displayed
* @type {Function}
*/
this.onAfterShow = isFn(f.on_after_show_msg) ?
f.on_after_show_msg : null;
f.on_after_show_msg : EMPTY_FN;
/**
* Callback fired before the message is hidden
* @type {Function}
*/
this.onBeforeHide = isFn(f.on_before_hide_msg) ?
f.on_before_hide_msg : null;
f.on_before_hide_msg : EMPTY_FN;
/**
* Callback fired after the message is hidden
* @type {Function}
*/
this.onAfterHide = isFn(f.on_after_hide_msg) ?
f.on_after_hide_msg : null;
f.on_after_hide_msg : EMPTY_FN;
}
/**
@ -141,17 +141,12 @@ export class NoResults extends Feature {
if (!this.initialized || !this.isEnabled()) {
return;
}
if (this.onBeforeShow) {
this.onBeforeShow.call(null, this.tf, this);
}
this.onBeforeShow(this.tf, this);
this.setWidth();
this.cont.style.display = 'block';
if (this.onAfterShow) {
this.onAfterShow.call(null, this.tf, this);
}
this.onAfterShow(this.tf, this);
}
/**
@ -161,16 +156,11 @@ export class NoResults extends Feature {
if (!this.initialized || !this.isEnabled()) {
return;
}
if (this.onBeforeHide) {
this.onBeforeHide.call(null, this.tf, this);
}
this.onBeforeHide(this.tf, this);
this.cont.style.display = NONE;
if (this.onAfterHide) {
this.onAfterHide.call(null, this.tf, this);
}
this.onAfterHide(this.tf, this);
}
/**

View file

@ -1,6 +1,6 @@
import {Feature} from '../feature';
import {createElm, createOpt, createText, elm, removeElm} from '../dom';
import {isArray, isFn, isNull} from '../types';
import {isArray, isFn, isNull, EMPTY_FN} from '../types';
import {addEvt, keyCode, removeEvt} from '../event';
import {INPUT, SELECT, NONE, ENTER_KEY} from '../const';
@ -211,14 +211,14 @@ export class Paging extends Feature {
* @type {Function}
*/
this.onBeforeChangePage = isFn(f.on_before_change_page) ?
f.on_before_change_page : null;
f.on_before_change_page : EMPTY_FN;
/**
* Callback fired after the page is changed
* @type {Function}
*/
this.onAfterChangePage = isFn(f.on_after_change_page) ?
f.on_after_change_page : null;
f.on_after_change_page : EMPTY_FN;
/**
* Label preciding results per page select
@ -717,9 +717,8 @@ export class Paging extends Feature {
this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1;
}
if (index >= 0 && index <= (this.nbPages - 1)) {
if (this.onBeforeChangePage) {
this.onBeforeChangePage.call(null, this, (index + 1));
}
this.onBeforeChangePage(this, (index + 1));
this.currentPageNb = parseInt(index, 10) + 1;
if (this.pageSelectorType === SELECT) {
this.pagingSlc.options[index].selected = true;
@ -732,9 +731,7 @@ export class Paging extends Feature {
this.groupByPage();
if (this.onAfterChangePage) {
this.onAfterChangePage.call(null, this, (index + 1));
}
this.onAfterChangePage(this, (index + 1));
}
this.emitter.emit('after-page-change', tf, (index + 1));

View file

@ -1,5 +1,5 @@
import {Feature} from '../feature';
import {isFn, isUndef} from '../types';
import {isFn, isUndef, EMPTY_FN} from '../types';
import {createElm, removeElm} from '../dom';
import {addEvt, cancelEvt, stopEvt, targetEvt, removeEvt} from '../event';
import {INPUT, NONE, CHECKLIST, MULTIPLE} from '../const';
@ -74,28 +74,28 @@ export class PopupFilter extends Feature {
* @type {Function}
*/
this.onBeforeOpen = isFn(f.on_before_popup_filter_open) ?
f.on_before_popup_filter_open : null;
f.on_before_popup_filter_open : EMPTY_FN;
/**
* Callback fired after a popup filter is opened
* @type {Function}
*/
this.onAfterOpen = isFn(f.on_after_popup_filter_open) ?
f.on_after_popup_filter_open : null;
f.on_after_popup_filter_open : EMPTY_FN;
/**
* Callback fired before a popup filter is closed
* @type {Function}
*/
this.onBeforeClose = isFn(f.on_before_popup_filter_close) ?
f.on_before_popup_filter_close : null;
f.on_before_popup_filter_close : EMPTY_FN;
/**
* Callback fired after a popup filter is closed
* @type {Function}
*/
this.onAfterClose = isFn(f.on_after_popup_filter_close) ?
f.on_after_popup_filter_close : null;
f.on_after_popup_filter_close : EMPTY_FN;
/**
* Collection of filters spans
@ -307,9 +307,8 @@ export class PopupFilter extends Feature {
let tf = this.tf,
container = this.fltElms[colIndex];
if (this.onBeforeOpen) {
this.onBeforeOpen.call(null, this, container, colIndex);
}
this.onBeforeOpen(this, container, colIndex);
container.style.display = 'block';
this.activeFilterIdx = colIndex;
addEvt(root, 'mouseup', (evt) => this.onMouseup(evt));
@ -320,9 +319,8 @@ export class PopupFilter extends Feature {
flt.focus();
}
}
if (this.onAfterOpen) {
this.onAfterOpen.call(null, this, container, colIndex);
}
this.onAfterOpen(this, container, colIndex);
}
/**
@ -331,17 +329,16 @@ export class PopupFilter extends Feature {
*/
close(colIndex) {
let container = this.fltElms[colIndex];
if (this.onBeforeClose) {
this.onBeforeClose.call(null, this, container, colIndex);
}
this.onBeforeClose(this, container, colIndex);
container.style.display = NONE;
if (this.activeFilterIdx === colIndex) {
this.activeFilterIdx = -1;
}
removeEvt(root, 'mouseup', (evt) => this.onMouseup(evt));
if (this.onAfterClose) {
this.onAfterClose.call(null, this, container, colIndex);
}
this.onAfterClose(this, container, colIndex);
}
/**

View file

@ -1,6 +1,6 @@
import {Feature} from '../feature';
import {createElm, createText, elm, removeElm} from '../dom';
import {isFn} from '../types';
import {isFn, EMPTY_FN} from '../types';
/**
* Rows counter UI component
@ -72,14 +72,14 @@ export class RowsCounter extends Feature {
* @type {Function}
*/
this.onBeforeRefreshCounter = isFn(f.on_before_refresh_counter) ?
f.on_before_refresh_counter : null;
f.on_before_refresh_counter : EMPTY_FN;
/**
* Callback fired after the counter is refreshed
* @type {Function}
*/
this.onAfterRefreshCounter = isFn(f.on_after_refresh_counter) ?
f.on_after_refresh_counter : null;
f.on_after_refresh_counter : EMPTY_FN;
}
/**
@ -142,9 +142,7 @@ export class RowsCounter extends Feature {
let tf = this.tf;
if (this.onBeforeRefreshCounter) {
this.onBeforeRefreshCounter.call(null, tf, this.label);
}
this.onBeforeRefreshCounter(tf, this.label);
let totTxt;
if (!tf.paging) {
@ -170,9 +168,7 @@ export class RowsCounter extends Feature {
}
this.label.innerHTML = totTxt;
if (this.onAfterRefreshCounter) {
this.onAfterRefreshCounter.call(null, tf, this.label, totTxt);
}
this.onAfterRefreshCounter(tf, this.label, totTxt);
}
/**

View file

@ -1,7 +1,7 @@
import {Feature} from '../feature';
import {root} from '../root';
import {createElm, createText, elm, removeElm} from '../dom';
import {isFn} from '../types';
import {isFn, EMPTY_FN} from '../types';
const EVENTS = [
'after-filtering',
@ -84,14 +84,14 @@ export class StatusBar extends Feature {
* @type {Function}
*/
this.onBeforeShowMsg = isFn(f.on_before_show_msg) ?
f.on_before_show_msg : null;
f.on_before_show_msg : EMPTY_FN;
/**
* Callback fired after the message is displayed
* @type {Function}
*/
this.onAfterShowMsg = isFn(f.on_after_show_msg) ?
f.on_after_show_msg : null;
f.on_after_show_msg : EMPTY_FN;
/**
* Message appearing upon filtering
@ -242,9 +242,7 @@ export class StatusBar extends Feature {
return;
}
if (this.onBeforeShowMsg) {
this.onBeforeShowMsg.call(null, this.tf, t);
}
this.onBeforeShowMsg(this.tf, t);
let d = t === '' ? this.delay : 1;
root.setTimeout(() => {
@ -252,9 +250,8 @@ export class StatusBar extends Feature {
return;
}
this.msgContainer.innerHTML = t;
if (this.onAfterShowMsg) {
this.onAfterShowMsg.call(null, this.tf, t);
}
this.onAfterShowMsg(this.tf, t);
}, d);
}