mirror of
https://github.com/koalyptus/TableFilter.git
synced 2026-03-16 23:55:46 +01:00
Assigned empty function to callbacks
This commit is contained in:
parent
8af59ef676
commit
c75fbe169c
21 changed files with 136 additions and 172 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue