mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-06-08 08:52:32 +02:00
204 lines
7.6 KiB
HTML
204 lines
7.6 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<base data-ice="baseUrl" href="../../../">
|
||
|
<title data-ice="title">src/modules/statusBar.js | TableFilter v0.0.0 API Document</title>
|
||
|
<link type="text/css" rel="stylesheet" href="css/style.css">
|
||
|
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
|
||
|
<script src="script/prettify/prettify.js"></script>
|
||
|
|
||
|
|
||
|
</head>
|
||
|
<body class="layout-container">
|
||
|
|
||
|
<header>
|
||
|
<a href="./">Home</a>
|
||
|
<a href="identifiers.html">Identifier</a>
|
||
|
<a href="source.html">Source</a>
|
||
|
|
||
|
<a data-ice="repoURL" href="https://github.com/koalyptus/TableFilter.git" class="repo-url-github">Repository</a>
|
||
|
<div class="search-box">
|
||
|
<span>
|
||
|
<img src="./image/search.png">
|
||
|
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
|
||
|
</span>
|
||
|
<ul class="search-result"></ul>
|
||
|
</div>
|
||
|
</header>
|
||
|
|
||
|
<nav class="navigation" data-ice="nav"><div data-ice="classWrap">
|
||
|
<h2>Class</h2>
|
||
|
<ul>
|
||
|
|
||
|
<li data-ice="classDoc"><span><a href="class/src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable.html">AdapterEzEditTable</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/extensions/sort/adapterSortabletable.js~AdapterSortableTable.html">AdapterSortableTable</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/alternateRows.js~AlternateRows.html">AlternateRows</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/checkList.js~CheckList.html">CheckList</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/clearButton.js~ClearButton.html">ClearButton</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/extensions/colOps/colOps.js~ColOps.html">ColOps</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/extensions/colsVisibility/colsVisibility.js~ColsVisibility.html">ColsVisibility</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/dropdown.js~Dropdown.html">Dropdown</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility.html">FiltersVisibility</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/gridLayout.js~GridLayout.html">GridLayout</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/help.js~Help.html">Help</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/highlightKeywords.js~HighlightKeyword.html">HighlightKeyword</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/loader.js~Loader.html">Loader</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/paging.js~Paging.html">Paging</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/popupFilter.js~PopupFilter.html">PopupFilter</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/rowsCounter.js~RowsCounter.html">RowsCounter</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/statusBar.js~StatusBar.html">StatusBar</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/modules/store.js~Store.html">Store</a></span></li>
|
||
|
<li data-ice="classDoc"><span><a href="class/src/tablefilter.js~TableFilter.html">TableFilter</a></span></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</nav>
|
||
|
|
||
|
<div class="content" data-ice="content"><h1 data-ice="title">src/modules/statusBar.js</h1>
|
||
|
<pre class="source-code line-number"><code class="prettyprint linenums" data-ice="content">import Dom from '../dom';
|
||
|
import Types from '../types';
|
||
|
|
||
|
var global = window;
|
||
|
|
||
|
export class StatusBar{
|
||
|
|
||
|
/**
|
||
|
* Status bar UI component
|
||
|
* @param {Object} tf TableFilter instance
|
||
|
*/
|
||
|
constructor(tf){
|
||
|
// Configuration object
|
||
|
var f = tf.config();
|
||
|
|
||
|
//id of custom container element
|
||
|
this.statusBarTgtId = f.status_bar_target_id || null;
|
||
|
//element containing status bar label
|
||
|
this.statusBarDiv = null;
|
||
|
//status bar
|
||
|
this.statusBarSpan = null;
|
||
|
//status bar label
|
||
|
this.statusBarSpanText = null;
|
||
|
//defines status bar text
|
||
|
this.statusBarText = f.status_bar_text || '';
|
||
|
//defines css class status bar
|
||
|
this.statusBarCssClass = f.status_bar_css_class || 'status';
|
||
|
//delay for status bar clearing
|
||
|
this.statusBarCloseDelay = 250;
|
||
|
|
||
|
//calls function before message is displayed
|
||
|
this.onBeforeShowMsg = Types.isFn(f.on_before_show_msg) ?
|
||
|
f.on_before_show_msg : null;
|
||
|
//calls function after message is displayed
|
||
|
this.onAfterShowMsg = Types.isFn(f.on_after_show_msg) ?
|
||
|
f.on_after_show_msg : null;
|
||
|
|
||
|
// status bar div
|
||
|
this.prfxStatus = 'status_';
|
||
|
// status bar label
|
||
|
this.prfxStatusSpan = 'statusSpan_';
|
||
|
// text preceding status bar label
|
||
|
this.prfxStatusTxt = 'statusText_';
|
||
|
|
||
|
this.tf = tf;
|
||
|
}
|
||
|
|
||
|
init(){
|
||
|
var tf = this.tf;
|
||
|
if(!tf.hasGrid() && !tf.isFirstLoad){
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
//status bar container
|
||
|
var statusDiv = Dom.create('div', ['id', this.prfxStatus+tf.id]);
|
||
|
statusDiv.className = this.statusBarCssClass;
|
||
|
|
||
|
//status bar label
|
||
|
var statusSpan = Dom.create('span', ['id', this.prfxStatusSpan+tf.id]);
|
||
|
//preceding text
|
||
|
var statusSpanText = Dom.create('span',
|
||
|
['id', this.prfxStatusTxt+tf.id]);
|
||
|
statusSpanText.appendChild(Dom.text(this.statusBarText));
|
||
|
|
||
|
// target element container
|
||
|
if(!this.statusBarTgtId){
|
||
|
tf.setToolbar();
|
||
|
}
|
||
|
var targetEl = (!this.statusBarTgtId) ?
|
||
|
tf.lDiv : Dom.id(this.statusBarTgtId);
|
||
|
|
||
|
//default container: 'lDiv'
|
||
|
if(!this.statusBarTgtId){
|
||
|
statusDiv.appendChild(statusSpanText);
|
||
|
statusDiv.appendChild(statusSpan);
|
||
|
targetEl.appendChild(statusDiv);
|
||
|
} else {
|
||
|
// custom container, no need to append statusDiv
|
||
|
targetEl.appendChild(statusSpanText);
|
||
|
targetEl.appendChild(statusSpan);
|
||
|
}
|
||
|
|
||
|
this.statusBarDiv = statusDiv;
|
||
|
this.statusBarSpan = statusSpan;
|
||
|
this.statusBarSpanText = statusSpanText;
|
||
|
|
||
|
}
|
||
|
|
||
|
message(t=''){
|
||
|
var tf = this.tf;
|
||
|
if(!tf.statusBar || !this.statusBarSpan){
|
||
|
return;
|
||
|
}
|
||
|
if(this.onBeforeShowMsg){
|
||
|
this.onBeforeShowMsg.call(null, this.tf, t);
|
||
|
}
|
||
|
|
||
|
var d = t==='' ? this.statusBarCloseDelay : 1;
|
||
|
global.setTimeout(() => {
|
||
|
this.statusBarSpan.innerHTML = t;
|
||
|
if(this.onAfterShowMsg){
|
||
|
this.onAfterShowMsg.call(null, this.tf, t);
|
||
|
}
|
||
|
}, d);
|
||
|
}
|
||
|
|
||
|
destroy(){
|
||
|
var tf = this.tf;
|
||
|
if(!tf.hasGrid() || !this.statusBarDiv){
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
this.statusBarDiv.innerHTML = '';
|
||
|
this.statusBarDiv.parentNode.removeChild(this.statusBarDiv);
|
||
|
this.statusBarSpan = null;
|
||
|
this.statusBarSpanText = null;
|
||
|
this.statusBarDiv = null;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
</code></pre>
|
||
|
</div>
|
||
|
|
||
|
<footer class="footer">
|
||
|
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(0.1.4)</span></a>
|
||
|
</footer>
|
||
|
|
||
|
<script src="script/search_index.js"></script>
|
||
|
<script src="script/search.js"></script>
|
||
|
<script src="script/pretty-print.js"></script>
|
||
|
<script src="script/inherited-summary.js"></script>
|
||
|
<script src="script/test-summary.js"></script>
|
||
|
<script src="script/inner-link.js"></script>
|
||
|
<script src="script/patch-for-local.js"></script>
|
||
|
</body>
|
||
|
</html>
|