1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-04 15:43:15 +02:00
This commit is contained in:
koalyptus 2017-10-08 21:14:25 +11:00
parent abec798b27
commit 7888a8ee24
19 changed files with 23616 additions and 109 deletions

4
dist/starter.html vendored
View file

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

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.5.42 by Max Guglielmi
* build date: 2017-09-23T11:28:32.094Z
* tablefilter v0.5.43 by Max Guglielmi
* build date: 2017-10-06T22:49:20.106Z
* 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:inherit;}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-type: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.5.42 by Max Guglielmi
* build date: 2017-09-23T11:28:32.094Z
* tablefilter v0.5.43 by Max Guglielmi
* build date: 2017-10-06T22:49:20.106Z
* 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.5.42 by Max Guglielmi
* build date: 2017-09-23T11:28:32.094Z
* tablefilter v0.5.43 by Max Guglielmi
* build date: 2017-10-06T22:49:20.106Z
* MIT License
*/
.activeHeader{background-color:#66afe9 !important;color:#fff !important}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.5.42 by Max Guglielmi
* build date: 2017-09-23T11:28:32.094Z
* tablefilter v0.5.43 by Max Guglielmi
* build date: 2017-10-06T22:49:20.106Z
* 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.5.42 by Max Guglielmi
* build date: 2017-09-23T11:28:32.094Z
* tablefilter v0.5.43 by Max Guglielmi
* build date: 2017-10-06T22:49:20.106Z
* 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.5.42 by Max Guglielmi
* build date: 2017-09-23T11:28:32.094Z
* tablefilter v0.5.43 by Max Guglielmi
* build date: 2017-10-06T22:49:20.106Z
* 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.5.42 by Max Guglielmi
* build date: 2017-09-23T11:28:32.094Z
* tablefilter v0.5.43 by Max Guglielmi
* build date: 2017-10-06T22:49:20.106Z
* 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

@ -3,13 +3,14 @@ import {
addClass, removeClass, createCheckItem, createElm, elm, removeElm,
getText, tag
} from '../../dom';
import {isUndef, EMPTY_FN} from '../../types';
import {isUndef, EMPTY_FN, isNull} from '../../types';
import {addEvt, targetEvt, removeEvt} from '../../event';
import {root} from '../../root';
import {NONE} from '../../const';
import {
defaultsBool, defaultsStr, defaultsFn, defaultsNb, defaultsArr
} from '../../settings';
import {RIGHT} from '../../modules/toolbar';
/**
* Columns Visibility extension
@ -207,6 +208,12 @@ export default class ColsVisibility extends Feature {
*/
this.tickAllText = defaultsStr(f.tick_all_text, 'Select all:');
/**
* Default position in toolbar ('left'|'center'|'right')
* @type {String}
*/
this.toolbarPosition = defaultsStr(f.toolbar_position, RIGHT);
/**
* List of indexes of hidden columns
* @private
@ -369,6 +376,9 @@ export default class ColsVisibility extends Feature {
return;
}
this.emitter.emit('initializing-extension', this,
!isNull(this.btnTgtId));
this.emitter.on(['hide-column'],
(tf, colIndex) => this.hideCol(colIndex));
@ -381,6 +391,7 @@ export default class ColsVisibility extends Feature {
this.boundMouseup = this.onMouseup.bind(this);
this.emitter.emit('columns-visibility-initialized', this.tf, this);
this.emitter.emit('extension-initialized', this);
// Hide columns at start at very end of initialization, do not move
// as order is important
@ -399,10 +410,12 @@ export default class ColsVisibility extends Feature {
span.className = this.spanCssClass;
//Container element (rdiv or custom element)
if (!this.btnTgtId) {
tf.setToolbar();
}
let targetEl = !this.btnTgtId ? tf.rDiv : elm(this.btnTgtId);
// if (!this.btnTgtId) {
// tf.setToolbar();
// }
let targetEl = !this.btnTgtId ? /*tf.rDiv*/
tf.feature('toolbar').container(this.toolbarPosition) :
elm(this.btnTgtId);
if (!this.btnTgtId) {
let firstChild = targetEl.firstChild;

View file

@ -1,10 +1,11 @@
import {Feature} from '../../feature';
import {createElm, removeElm, elm} from '../../dom';
import {EMPTY_FN} from '../../types';
import {EMPTY_FN, isNull} from '../../types';
import {addEvt} from '../../event';
import {
defaultsBool, defaultsStr, defaultsFn, defaultsNb,
} from '../../settings';
import {RIGHT} from '../../modules/toolbar';
/**
* Filters Visibility extension
@ -147,6 +148,12 @@ export default class FiltersVisibility extends Feature {
*/
this.visibleAtStart = defaultsNb(f.visible_at_start, true);
/**
* Default position in toolbar ('left'|'center'|'right')
* @type {String}
*/
this.toolbarPosition = defaultsStr(f.toolbar_position, RIGHT);
/**
* Callback fired before filters row is shown
* @type {Function}
@ -186,15 +193,17 @@ export default class FiltersVisibility extends Feature {
return;
}
this.emitter.emit('initializing-extension', this,
!isNull(this.targetId));
this.buildUI();
/**
* @inherited
*/
/** @inherited */
this.initialized = true;
this.emitter.on(['show-filters'], (tf, visible) => this.show(visible));
this.emitter.emit('filters-visibility-initialized', this.tf, this);
this.emitter.emit('extension-initialized', this);
}
/**
@ -206,10 +215,12 @@ export default class FiltersVisibility extends Feature {
span.className = this.contCssClass;
//Container element (rdiv or custom element)
if (!this.targetId) {
tf.setToolbar();
}
let targetEl = !this.targetId ? tf.rDiv : elm(this.targetId);
// if (!this.targetId) {
// tf.setToolbar();
// }
let targetEl = !this.targetId ? /*tf.rDiv*/
tf.feature('toolbar').container(this.toolbarPosition) :
elm(this.targetId);
if (!this.targetId) {
let firstChild = targetEl.firstChild;

View file

@ -3,6 +3,7 @@ import {createElm, createText, elm, removeElm} from '../dom';
import {addEvt} from '../event';
import {defaultsStr} from '../settings';
import {isNull} from '../types';
import {RIGHT} from './toolbar';
/**
* Clear button UI component
@ -64,6 +65,12 @@ export class ClearButton extends Feature {
(!tf.enableIcons ? null :
'<input type="button" value="" class="' + this.cssClass +
'" ' + 'title="' + this.tooltip + '" />'));
/**
* Default position in toolbar ('left'|'center'|'right')
* @type {String}
*/
this.toolbarPosition = defaultsStr(f.toolbar_position, RIGHT);
}
/**
@ -87,17 +94,18 @@ export class ClearButton extends Feature {
return;
}
this.emitter.emit('initializing-feature', this, !isNull(this.targetId));
let cont = createElm('span');
// reset button is added to defined element
// if (!this.targetId) {
// tf.setToolbar();
// }
this.emitter.emit('initializing-feature', this,
!isNull(this.targetId));
let targetEl = !this.targetId ? /*tf.rDiv*/
tf.feature('toolbar').right() : elm(this.targetId);
tf.feature('toolbar').container(this.toolbarPosition) :
elm(this.targetId);
targetEl.appendChild(cont);
if (!this.html) {

View file

@ -3,8 +3,9 @@ import {createElm, createText, elm, removeElm} from '../dom';
import {addEvt, targetEvt, removeEvt} from '../event';
import {NONE} from '../const';
import {root} from '../root';
import {isEmpty} from '../types';
import {isEmpty, isNull} from '../types';
import {defaultsStr} from '../settings';
import {RIGHT} from './toolbar';
const WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' +
'4.-Filter-operators';
@ -108,6 +109,12 @@ export class Help extends Feature {
'<div align="center" style="margin-top:8px;">' +
'<a href="javascript:void(0);" class="close">Close</a></div></div>';
/**
* Default position in toolbar ('left'|'center'|'right')
* @type {String}
*/
this.toolbarPosition = defaultsStr(f.toolbar_position, RIGHT);
this.emitter.on(['init-help'], () => this.init());
}
@ -137,6 +144,8 @@ export class Help extends Feature {
return;
}
this.emitter.emit('initializing-feature', this, !isNull(this.tgtId));
let tf = this.tf;
let btn = createElm('span');
@ -145,10 +154,13 @@ export class Help extends Feature {
this.boundMouseup = this.onMouseup.bind(this);
//help button is added to defined element
if (!this.tgtId) {
tf.setToolbar();
}
let targetEl = !this.tgtId ? tf.rDiv : elm(this.tgtId);
// if (!this.tgtId) {
// tf.setToolbar();
// }
let targetEl = !this.tgtId ?
tf.feature('toolbar').container(this.toolbarPosition) :
elm(this.tgtId);
targetEl.appendChild(btn);
let divContainer = !this.contTgtId ? btn : elm(this.contTgtId);
@ -186,6 +198,8 @@ export class Help extends Feature {
this.btn = btn;
/** @inherited */
this.initialized = true;
this.emitter.emit('feature-initialized', this);
}
/**

View file

@ -6,6 +6,7 @@ import {INPUT, SELECT, NONE, ENTER_KEY} from '../const';
import {
defaultsStr, defaultsNb, defaultsBool, defaultsArr, defaultsFn
} from '../settings';
import {CENTER, RIGHT} from './toolbar';
/**
* Paging UI component
@ -210,6 +211,12 @@ export class Paging extends Feature {
*/
this.pageSelectorType = defaultsStr(f.page_selector_type, SELECT);
/**
* Default position in toolbar ('left'|'center'|'right')
* @type {String}
*/
this.toolbarPosition = defaultsStr(f.toolbar_position, CENTER);
/**
* Callback fired before the page is changed
* @type {Function}
@ -341,6 +348,8 @@ export class Paging extends Feature {
return;
}
this.emitter.emit('initializing-feature', this, !isNull(this.tgtId));
// Check resultsPerPage is in expected format and initialise the
// results per page component
if (this.hasResultsPerPage) {
@ -437,10 +446,12 @@ export class Paging extends Feature {
}
// paging elements (buttons+drop-down list) are added to defined element
if (!this.tgtId) {
tf.setToolbar();
}
let targetEl = !this.tgtId ? tf.mDiv : elm(this.tgtId);
// if (!this.tgtId) {
// tf.setToolbar();
// }
let targetEl = !this.tgtId ? /*tf.mDiv*/
tf.feature('toolbar').container(this.toolbarPosition) :
elm(this.tgtId);
targetEl.appendChild(btnFirstSpan);
targetEl.appendChild(btnPrevSpan);
@ -484,6 +495,8 @@ export class Paging extends Feature {
/** @inherited */
this.initialized = true;
this.emitter.emit('feature-initialized', this);
}
/**
@ -515,7 +528,9 @@ export class Paging extends Feature {
*/
setPagingInfo(validRows) {
let tf = this.tf;
let mdiv = !this.tgtId ? tf.mDiv : elm(this.tgtId);
let cont = !this.tgtId ? /*tf.mDiv*/
tf.feature('toolbar').container(this.toolbarPosition) :
elm(this.tgtId);
//store valid rows indexes
tf.validRowsIndex = validRows || tf.getValidRows(true);
@ -530,7 +545,7 @@ export class Paging extends Feature {
}
if (this.nbPages > 0) {
mdiv.style.visibility = 'visible';
cont.style.visibility = 'visible';
if (this.pageSelectorType === SELECT) {
for (let z = 0; z < this.nbPages; z++) {
let opt = createOpt(z + 1, z * this.pageLength, false);
@ -543,7 +558,7 @@ export class Paging extends Feature {
} else {
/*** if no results paging select and buttons are hidden ***/
mdiv.style.visibility = 'hidden';
cont.style.visibility = 'hidden';
}
this.groupByPage(tf.validRowsIndex);
}
@ -653,11 +668,12 @@ export class Paging extends Feature {
slcRSpan.className = this.resultsSpanCssClass;
// results per page select is added to external element
if (!this.pageLengthTgtId) {
tf.setToolbar();
}
// if (!this.pageLengthTgtId) {
// tf.setToolbar();
// }
let targetEl = !this.pageLengthTgtId ?
tf.rDiv : elm(this.pageLengthTgtId);
tf.feature('toolbar').container(RIGHT) :
elm(this.pageLengthTgtId);
slcRSpan.appendChild(createText(slcRText));
let help = tf.feature('help');

View file

@ -1,7 +1,8 @@
import {Feature} from '../feature';
import {createElm, createText, elm, removeElm} from '../dom';
import {EMPTY_FN} from '../types';
import {EMPTY_FN, isNull} from '../types';
import {defaultsStr, defaultsFn} from '../settings';
import {LEFT} from './toolbar';
/**
* Rows counter UI component
@ -68,6 +69,12 @@ export class RowsCounter extends Feature {
*/
this.cssClass = defaultsStr(f.css_class, 'tot');
/**
* Default position in toolbar ('left'|'center'|'right')
* @type {String}
*/
this.toolbarPosition = defaultsStr(f.toolbar_position, LEFT);
/**
* Callback fired before the counter is refreshed
* @type {Function}
@ -91,6 +98,8 @@ export class RowsCounter extends Feature {
return;
}
this.emitter.emit('initializing-feature', this, !isNull(this.targetId));
let tf = this.tf;
//rows counter container
@ -102,10 +111,12 @@ export class RowsCounter extends Feature {
countText.appendChild(createText(this.text));
// counter is added to defined element
if (!this.targetId) {
tf.setToolbar();
}
let targetEl = !this.targetId ? tf.lDiv : elm(this.targetId);
// if (!this.targetId) {
// tf.setToolbar();
// }
let targetEl = !this.targetId ? /*tf.lDiv*/
tf.feature('toolbar').container(this.toolbarPosition) :
elm(this.targetId);
//default container: 'lDiv'
if (!this.targetId) {
@ -128,6 +139,8 @@ export class RowsCounter extends Feature {
/** @inherited */
this.initialized = true;
this.refresh();
this.emitter.emit('feature-initialized', this);
}
/**

View file

@ -1,8 +1,9 @@
import {Feature} from '../feature';
import {root} from '../root';
import {createElm, createText, elm, removeElm} from '../dom';
import {EMPTY_FN} from '../types';
import {EMPTY_FN, isNull} from '../types';
import {defaultsStr, defaultsFn} from '../settings';
import {LEFT} from './toolbar';
const EVENTS = [
'after-filtering',
@ -163,6 +164,12 @@ export class StatusBar extends Feature {
*/
this.msgLoadThemes = defaultsStr(f.msg_load_themes,
'Loading theme(s)...');
/**
* Default position in toolbar ('left'|'center'|'right')
* @type {String}
*/
this.toolbarPosition = defaultsStr(f.toolbar_position, LEFT);
}
/**
@ -176,6 +183,8 @@ export class StatusBar extends Feature {
let tf = this.tf;
let emitter = this.emitter;
emitter.emit('initializing-feature', this, !isNull(this.targetId));
//status bar container
let statusDiv = createElm('div');
statusDiv.className = this.cssClass;
@ -187,10 +196,12 @@ export class StatusBar extends Feature {
statusSpanText.appendChild(createText(this.text));
// target element container
if (!this.targetId) {
tf.setToolbar();
}
let targetEl = (!this.targetId) ? tf.lDiv : elm(this.targetId);
// if (!this.targetId) {
// tf.setToolbar();
// }
let targetEl = (!this.targetId) ? /*tf.lDiv*/
tf.feature('toolbar').container(this.toolbarPosition) :
elm(this.targetId);
//default container: 'lDiv'
if (!this.targetId) {
@ -230,6 +241,8 @@ export class StatusBar extends Feature {
/** @inherited */
this.initialized = true;
emitter.emit('feature-initialized', this);
}
/**

View file

@ -1,12 +1,16 @@
import {Feature} from '../feature';
import {createElm, removeElm, elm} from '../dom';
import {createElm, removeElm, elm, tag} from '../dom';
import {defaultsStr} from '../settings';
import {isUndef} from '../types';
const EVENTS = [
'initializing-feature'
'initializing-feature',
'initializing-extension'
];
export const LEFT = 'left';
export const RIGHT = 'right';
export const CENTER = 'center';
/**
* Toolbar UI component
@ -86,7 +90,7 @@ export class Toolbar extends Feature {
*/
this.mDiv = null;
/**
/**
* Toolbar container ID prefix
* @private
*/
@ -110,19 +114,22 @@ export class Toolbar extends Feature {
*/
this.prfxMDiv = 'mdiv_';
/**
* Container elements inside toolbar
* @private
*/
this.cont = {
left: null,
center: null,
right: null
};
this.emitter.on(EVENTS,
(feature, isExternal) => this.tryInit(isExternal));
(feature, isExternal) => this.init(isExternal));
}
tryInit(isExternal) {
if (isExternal) {
return;
}
this.init();
}
init() {
if (this.initialized) {
init(isExternal) {
if (this.initialized || isExternal) {
return;
}
@ -136,13 +143,13 @@ export class Toolbar extends Feature {
if (this.toolBarTgtId) {
elm(this.toolBarTgtId).appendChild(infDiv);
}
//grid-layout
// grid-layout
else if (tf.gridLayout) {
let gridLayout = tf.Mod.gridLayout;
gridLayout.tblMainCont.appendChild(infDiv);
infDiv.className = gridLayout.infDivCssClass;
}
//default location: just above the table
// default location: just above the table
else {
let cont = createElm('caption');
cont.appendChild(infDiv);
@ -154,20 +161,29 @@ export class Toolbar extends Feature {
// let lDiv = createElm('div');
// lDiv.className = this.lDivCssClass;
// infDiv.appendChild(lDiv);
this.lDiv = createContainer(infDiv, this.lDivCssClass);
this.lDiv = this.createContainer(infDiv, this.lDivCssClass);
/*** right div containing reset button
+ nb results per page select ***/
// let rDiv = createElm('div');
// rDiv.className = this.rDivCssClass;
// infDiv.appendChild(rDiv);
this.rDiv = createContainer(infDiv, this.rDivCssClass);
this.rDiv = this.createContainer(infDiv, this.rDivCssClass);
/*** mid div containing paging elements ***/
// let mDiv = createElm('div');
// mDiv.className = this.mDivCssClass;
// infDiv.appendChild(mDiv);
this.mDiv = createContainer(infDiv, this.mDivCssClass);
this.mDiv = this.createContainer(infDiv, this.mDivCssClass);
this.cont = {
left: this.lDiv,
center: this.mDiv,
right: this.rDiv
};
/** @inherited */
this.initialized = true;
// emit help initialisation only if undefined
if (isUndef(tf.help)) {
@ -176,35 +192,45 @@ export class Toolbar extends Feature {
tf.Mod.help.enable();
this.emitter.emit('init-help', tf);
}
/** @inherited */
this.initialized = true;
}
left(elm) {
// left(elm) {
// if (elm) {
// this.lDiv.appendChild(elm);
// }
// return this.lDiv;
// }
// middle(elm) {
// if (elm) {
// this.mDiv.appendChild(elm);
// }
// return this.mDiv;
// }
// right(elm) {
// if (elm) {
// this.rDiv.appendChild(elm);
// }
// return this.rDiv;
// }
container(position = RIGHT, elm) {
let cont = this.cont[position];
if (elm) {
this.lDiv.appendChild(elm);
cont.appendChild(elm);
}
return this.lDiv;
return cont;
}
middle(elm) {
if (elm) {
this.mDiv.appendChild(elm);
}
return this.mDiv;
}
right(elm) {
if (elm) {
this.rDiv.appendChild(elm);
}
return this.rDiv;
}
// insertIn(elm, position = RIGHT) {
// let cont = this.container[position];
// cont.appendChild(elm);
// return cont;
// }
createContainer(container, css) {
let div = createElm('div', ['class', css]);
// div.className = css;
container.appendChild(div);
return div;
}

View file

@ -1,7 +1,7 @@
import {addEvt, cancelEvt, stopEvt, targetEvt, keyCode} from './event';
import {
addClass, createElm, createOpt, elm, getText, getFirstTextNode,
removeClass, removeElm, tag
removeClass, /*removeElm,*/ tag
} from './dom';
import {contains, matchCase, rgxEsc, trim} from './string';
import {isEmpty as isEmptyString} from './string';
@ -974,7 +974,7 @@ export class TableFilter {
*/
this.ExtRegistry = {};
//conditionally instantiate required features
// conditionally instantiate required features
this.instantiateFeatures(
Object.keys(FEATURES).map((item) => FEATURES[item])
);
@ -1743,7 +1743,7 @@ export class TableFilter {
// isolate search term and check occurence in cell data
for (let w = 0, len = s.length; w < len; w++) {
cS = trim(s[w]);
occur = this._testTerm(cS, cellValue, j);
occur = this._matcth(cS, cellValue, j);
if (occur) {
this.emitter.emit('highlight-keyword', this,
@ -1762,7 +1762,7 @@ export class TableFilter {
}
//single search parameter
else {
occurence[j] = this._testTerm(trim(sA), cellValue, j);
occurence[j] = this._matcth(trim(sA), cellValue, j);
if (occurence[j]) {
this.emitter.emit('highlight-keyword', this, cells[j],
sA);
@ -1801,13 +1801,14 @@ export class TableFilter {
}
/**
* Test for a match of search term in cell data
* Match search term in cell data
* @param {String} term Search term
* @param {String} cellValue Cell data
* @param {Number} colIdx Column index
* @return {Boolean}
* @private
*/
_testTerm(term, cellValue, colIdx) {
_matcth(term, cellValue, colIdx) {
let numData;
let decimal = this.getDecimal(colIdx);
let reLe = new RegExp(this.leOperator),