[ { "kind": "file", "static": true, "variation": null, "name": "src/array.js", "memberof": null, "longname": "src/array.js", "access": null, "description": null, "lineNumber": 5, "content": "/**\n * Array utilities\n */\n\nimport Str from './string';\n\nexport default {\n has: function(arr, val, caseSensitive){\n let sCase = caseSensitive===undefined ? false : caseSensitive;\n for (var i=0; i2){\n return yr;\n }\n let y;\n //>50 belong to 1900\n if(yr <= 99 && yr>50){\n y = '19' + yr;\n }\n //<50 belong to 2000\n if(yr<50 || yr === '00'){\n y = '20' + yr;\n }\n return y;\n}\n\nfunction mmm2mm(mmm){\n if(mmm === undefined){\n return 0;\n }\n let mondigit;\n let MONTH_NAMES = [\n 'january','february','march','april','may','june','july',\n 'august','september','october','november','december',\n 'jan','feb','mar','apr','may','jun','jul','aug','sep','oct',\n 'nov','dec'\n ];\n for(let m_i=0; m_i < MONTH_NAMES.length; m_i++){\n let month_name = MONTH_NAMES[m_i];\n if (mmm.toLowerCase() === month_name){\n mondigit = m_i+1;\n break;\n }\n }\n if(mondigit > 11 || mondigit < 23){\n mondigit = mondigit - 12;\n }\n if(mondigit < 1 || mondigit > 12){\n return 0;\n }\n return mondigit;\n}\n" }, { "kind": "function", "static": true, "variation": null, "name": "y2kDate", "memberof": "src/date.js", "longname": "src/date.js~y2kDate", "access": null, "export": false, "importPath": "TableFilter/src/date.js", "importStyle": null, "description": null, "lineNumber": 128, "undocument": true, "params": [ { "name": "yr", "types": [ "*" ] } ], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "function", "static": true, "variation": null, "name": "mmm2mm", "memberof": "src/date.js", "longname": "src/date.js~mmm2mm", "access": null, "export": false, "importPath": "TableFilter/src/date.js", "importStyle": null, "description": null, "lineNumber": 147, "undocument": true, "params": [ { "name": "mmm", "types": [ "*" ] } ], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "file", "static": true, "variation": null, "name": "src/dom.js", "memberof": null, "longname": "src/dom.js", "access": null, "description": null, "lineNumber": 5, "content": "/**\n * DOM utilities\n */\n\nexport default {\n\n /**\n * Returns text + text of children of given node\n * @param {NodeElement} node\n * @return {String}\n */\n getText(node){\n let s = node.textContent || node.innerText ||\n node.innerHTML.replace(/<[^<>]+>/g, '');\n s = s.replace(/^\\s+/, '').replace(/\\s+$/, '');\n return s;\n },\n\n /**\n * Creates an html element with given collection of attributes\n * @param {String} tag a string of the html tag to create\n * @param {Array} an undetermined number of arrays containing the with 2\n * items, the attribute name and its value ['id','myId']\n * @return {Object} created element\n */\n create(tag){\n if(!tag || tag===''){\n return;\n }\n\n let el = document.createElement(tag),\n args = arguments;\n\n if(args.length > 1){\n for(let i=0; i { this._setAdvancedGrid(); });\n }\n if(this.loadStylesheet && !tf.isImported(this.stylesheet, 'link')){\n tf.import(this.stylesheetName, this.stylesheet, null, 'link');\n }\n }\n\n /**\n * Instantiate ezEditTable component for advanced grid features\n */\n _setAdvancedGrid(){\n var tf = this.tf;\n\n //start row for EditTable constructor needs to be calculated\n var startRow,\n cfg = this.cfg,\n thead = Dom.tag(tf.tbl, 'thead');\n\n //if thead exists and startRow not specified, startRow is calculated\n //automatically by EditTable\n if(thead.length > 0 && !cfg.startRow){\n startRow = undefined;\n }\n //otherwise startRow config property if any or TableFilter refRow\n else{\n startRow = cfg.startRow || tf.refRow;\n }\n\n cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/';\n var editable = cfg.editable;\n var selectable = cfg.selection;\n\n if(selectable){\n cfg.default_selection = cfg.default_selection || 'row';\n }\n //CSS Styles\n cfg.active_cell_css = cfg.active_cell_css || 'ezETSelectedCell';\n\n var _lastValidRowIndex = 0;\n var _lastRowIndex = 0;\n\n if(selectable){\n //Row navigation needs to be calculated according to TableFilter's\n //validRowsIndex array\n var onAfterSelection = function(et, selectedElm, e){\n var slc = et.Selection;\n //Next valid filtered row needs to be selected\n var doSelect = function(nextRowIndex){\n if(et.defaultSelection === 'row'){\n slc.SelectRowByIndex(nextRowIndex);\n } else {\n et.ClearSelections();\n var cellIndex = selectedElm.cellIndex,\n row = tf.tbl.rows[nextRowIndex];\n if(et.defaultSelection === 'both'){\n slc.SelectRowByIndex(nextRowIndex);\n }\n if(row){\n slc.SelectCell(row.cells[cellIndex]);\n }\n }\n //Table is filtered\n if(tf.validRowsIndex.length !== tf.getRowsNb()){\n var r = tf.tbl.rows[nextRowIndex];\n if(r){\n r.scrollIntoView(false);\n }\n if(cell){\n if(cell.cellIndex === (tf.getCellsNb()-1) &&\n tf.gridLayout){\n tf.tblCont.scrollLeft = 100000000;\n }\n else if(cell.cellIndex===0 && tf.gridLayout){\n tf.tblCont.scrollLeft = 0;\n } else {\n cell.scrollIntoView(false);\n }\n }\n }\n };\n\n //table is not filtered\n if(!tf.validRowsIndex){\n return;\n }\n var validIndexes = tf.validRowsIndex,\n validIdxLen = validIndexes.length,\n row = et.defaultSelection !== 'row' ?\n selectedElm.parentNode : selectedElm,\n //cell for default_selection = 'both' or 'cell'\n cell = selectedElm.nodeName==='TD' ? selectedElm : null,\n keyCode = e !== undefined ? et.Event.GetKey(e) : 0,\n isRowValid = Arr.has(validIndexes, row.rowIndex),\n nextRowIndex,\n //pgup/pgdown keys\n d = (keyCode === 34 || keyCode === 33 ?\n (tf.feature('paging').pagingLength ||\n et.nbRowsPerPage) : 1);\n\n //If next row is not valid, next valid filtered row needs to be\n //calculated\n if(!isRowValid){\n //Selection direction up/down\n if(row.rowIndex>_lastRowIndex){\n //last row\n if(row.rowIndex >= validIndexes[validIdxLen-1]){\n nextRowIndex = validIndexes[validIdxLen-1];\n } else {\n var calcRowIndex = (_lastValidRowIndex + d);\n if(calcRowIndex > (validIdxLen-1)){\n nextRowIndex = validIndexes[validIdxLen-1];\n } else {\n nextRowIndex = validIndexes[calcRowIndex];\n }\n }\n } else{\n //first row\n if(row.rowIndex <= validIndexes[0]){\n nextRowIndex = validIndexes[0];\n } else {\n var v = validIndexes[_lastValidRowIndex - d];\n nextRowIndex = v ? v : validIndexes[0];\n }\n }\n _lastRowIndex = row.rowIndex;\n doSelect(nextRowIndex);\n } else {\n //If filtered row is valid, special calculation for\n //pgup/pgdown keys\n if(keyCode!==34 && keyCode!==33){\n _lastValidRowIndex = Arr.indexByValue(validIndexes,\n row.rowIndex);\n _lastRowIndex = row.rowIndex;\n } else {\n if(keyCode === 34){ //pgdown\n //last row\n if((_lastValidRowIndex + d) <= (validIdxLen-1)){\n nextRowIndex = validIndexes[\n _lastValidRowIndex + d];\n } else {\n nextRowIndex = [validIdxLen-1];\n }\n } else { //pgup\n //first row\n if((_lastValidRowIndex - d) <= validIndexes[0]){\n nextRowIndex = validIndexes[0];\n } else {\n nextRowIndex = validIndexes[\n _lastValidRowIndex - d];\n }\n }\n _lastRowIndex = nextRowIndex;\n _lastValidRowIndex = Arr.indexByValue(validIndexes,\n nextRowIndex);\n doSelect(nextRowIndex);\n }\n }\n };\n\n //Page navigation has to be enforced whenever selected row is out of\n //the current page range\n var onBeforeSelection = function(et, selectedElm){\n var row = et.defaultSelection !== 'row' ?\n selectedElm.parentNode : selectedElm;\n if(tf.paging){\n if(tf.feature('paging').nbPages > 1){\n var paging = tf.feature('paging');\n //page length is re-assigned in case it has changed\n et.nbRowsPerPage = paging.pagingLength;\n var validIndexes = tf.validRowsIndex,\n validIdxLen = validIndexes.length,\n pagingEndRow = parseInt(paging.startPagingRow, 10) +\n parseInt(paging.pagingLength, 10);\n var rowIndex = row.rowIndex;\n\n if((rowIndex === validIndexes[validIdxLen-1]) &&\n paging.currentPageNb!==paging.nbPages){\n paging.setPage('last');\n }\n else if((rowIndex == validIndexes[0]) &&\n paging.currentPageNb!==1){\n paging.setPage('first');\n }\n else if(rowIndex > validIndexes[pagingEndRow-1] &&\n rowIndex < validIndexes[validIdxLen-1]){\n paging.setPage('next');\n }\n else if(\n rowIndex < validIndexes[paging.startPagingRow] &&\n rowIndex > validIndexes[0]){\n paging.setPage('previous');\n }\n }\n }\n };\n\n //Selected row needs to be visible when paging is activated\n if(tf.paging){\n tf.feature('paging').onAfterChangePage = function(paging){\n var advGrid = paging.tf.extension('advancedGrid');\n var et = advGrid._ezEditTable;\n var slc = et.Selection;\n var row = slc.GetActiveRow();\n if(row){\n row.scrollIntoView(false);\n }\n var cell = slc.GetActiveCell();\n if(cell){\n cell.scrollIntoView(false);\n }\n };\n }\n\n //Rows navigation when rows are filtered is performed with the\n //EditTable row selection callback events\n if(cfg.default_selection==='row'){\n var fnB = cfg.on_before_selected_row;\n cfg.on_before_selected_row = function(){\n onBeforeSelection(arguments[0], arguments[1], arguments[2]);\n if(fnB){\n fnB.call(\n null, arguments[0], arguments[1], arguments[2]);\n }\n };\n var fnA = cfg.on_after_selected_row;\n cfg.on_after_selected_row = function(){\n onAfterSelection(arguments[0], arguments[1], arguments[2]);\n if(fnA){\n fnA.call(\n null, arguments[0], arguments[1], arguments[2]);\n }\n };\n } else {\n var fnD = cfg.on_before_selected_cell;\n cfg.on_before_selected_cell = function(){\n onBeforeSelection(arguments[0], arguments[1], arguments[2]);\n if(fnD){\n fnD.call(\n null, arguments[0], arguments[1], arguments[2]);\n }\n };\n var fnC = cfg.on_after_selected_cell;\n cfg.on_after_selected_cell = function(){\n onAfterSelection(arguments[0], arguments[1], arguments[2]);\n if(fnC){\n fnC.call(\n null, arguments[0], arguments[1], arguments[2]);\n }\n };\n }\n }\n if(editable){\n //Added or removed rows, TF rows number needs to be re-calculated\n var fnE = cfg.on_added_dom_row;\n cfg.on_added_dom_row = function(){\n tf.nbFilterableRows++;\n if(!tf.paging){\n tf.feature('rowsCounter').refresh();\n } else {\n tf.nbRows++;\n tf.nbVisibleRows++;\n tf.nbFilterableRows++;\n tf.paging=false;\n tf.feature('paging').destroy();\n tf.feature('paging').reset();\n }\n if(tf.alternateBgs){\n tf.feature('alternateRows').init();\n }\n if(fnE){\n fnE.call(null, arguments[0], arguments[1], arguments[2]);\n }\n };\n if(cfg.actions && cfg.actions['delete']){\n var fnF = cfg.actions['delete'].on_after_submit;\n cfg.actions['delete'].on_after_submit = function(){\n tf.nbFilterableRows--;\n if(!tf.paging){\n tf.feature('rowsCounter').refresh();\n } else {\n tf.nbRows--;\n tf.nbVisibleRows--;\n tf.nbFilterableRows--;\n tf.paging=false;\n tf.feature('paging').destroy();\n tf.feature('paging').reset(false);\n }\n if(tf.alternateBgs){\n tf.feature('alternateRows').init();\n }\n if(fnF){\n fnF.call(null, arguments[0], arguments[1]);\n }\n };\n }\n }\n\n try{\n this._ezEditTable = new EditTable(tf.id, cfg, startRow);\n this._ezEditTable.Init();\n } catch(e) { throw new Error(this.err); }\n\n this.initialized = true;\n }\n\n /**\n * Reset advanced grid when previously removed\n */\n reset(){\n var ezEditTable = this._ezEditTable;\n if(ezEditTable){\n if(this.cfg.selection){\n ezEditTable.Selection.Set();\n }\n if(this.cfg.editable){\n ezEditTable.Editable.Set();\n }\n }\n }\n\n /**\n * Remove advanced grid\n */\n destroy(){\n var ezEditTable = this._ezEditTable;\n if(ezEditTable){\n if(this.cfg.selection){\n ezEditTable.Selection.ClearSelections();\n ezEditTable.Selection.Remove();\n }\n if(this.cfg.editable){\n ezEditTable.Editable.Remove();\n }\n }\n this.initialized = false;\n }\n}\n" }, { "kind": "class", "static": true, "variation": null, "name": "AdapterEzEditTable", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "access": null, "export": true, "importPath": "TableFilter/src/extensions/advancedGrid/adapterEzEditTable.js", "importStyle": "AdapterEzEditTable", "description": null, "lineNumber": 4, "undocument": true, "interface": false }, { "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#constructor", "access": null, "description": "Adapter module for ezEditTable, an external library providing advanced\ngrid features (selection and edition):\nhttp://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus", "lineNumber": 12, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "tf", "description": "TableFilter instance" } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "initialized", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#initialized", "access": null, "description": null, "lineNumber": 14, "undocument": true, "type": { "types": [ "boolean" ] } }, { "kind": "member", "static": false, "variation": null, "name": "desc", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#desc", "access": null, "description": null, "lineNumber": 15, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "filename", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#filename", "access": null, "description": null, "lineNumber": 16, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "vendorPath", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#vendorPath", "access": null, "description": null, "lineNumber": 17, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "loadStylesheet", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#loadStylesheet", "access": null, "description": null, "lineNumber": 18, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "stylesheet", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#stylesheet", "access": null, "description": null, "lineNumber": 19, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "stylesheetName", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#stylesheetName", "access": null, "description": null, "lineNumber": 20, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "err", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#err", "access": null, "description": null, "lineNumber": 21, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "_ezEditTable", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#_ezEditTable", "access": null, "description": null, "lineNumber": 27, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "cfg", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#cfg", "access": null, "description": null, "lineNumber": 28, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "tf", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#tf", "access": null, "description": null, "lineNumber": 29, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "init", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#init", "access": null, "description": "Conditionally load ezEditTable library and set advanced grid", "lineNumber": 36, "params": [], "return": { "nullable": null, "types": [ "[type]" ], "spread": false, "description": "[description]" }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "_setAdvancedGrid", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#_setAdvancedGrid", "access": null, "description": "Instantiate ezEditTable component for advanced grid features", "lineNumber": 52, "params": [], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "_ezEditTable", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#_ezEditTable", "access": null, "description": null, "lineNumber": 340, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "initialized", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#initialized", "access": null, "description": null, "lineNumber": 344, "undocument": true, "type": { "types": [ "boolean" ] } }, { "kind": "method", "static": false, "variation": null, "name": "reset", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#reset", "access": null, "description": "Reset advanced grid when previously removed", "lineNumber": 350, "params": [], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "destroy", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#destroy", "access": null, "description": "Remove advanced grid", "lineNumber": 365, "params": [], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "initialized", "memberof": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable", "longname": "src/extensions/advancedGrid/adapterEzEditTable.js~AdapterEzEditTable#initialized", "access": null, "description": null, "lineNumber": 376, "undocument": true, "type": { "types": [ "boolean" ] } }, { "kind": "file", "static": true, "variation": null, "name": "src/extensions/advancedGrid/advancedGrid.js", "memberof": null, "longname": "src/extensions/advancedGrid/advancedGrid.js", "access": null, "description": null, "lineNumber": 1, "content": "import AdapterEzEditTable from './adapterEzEditTable';\n\nexport default AdapterEzEditTable;" }, { "kind": "file", "static": true, "variation": null, "name": "src/extensions/colOps/colOps.js", "memberof": null, "longname": "src/extensions/colOps/colOps.js", "access": null, "description": null, "lineNumber": 1, "content": "import Dom from '../../dom';\nimport Str from '../../string';\nimport Types from '../../types';\n\nexport default class ColOps{\n\n /**\n * Column calculations\n * @param {Object} tf TableFilter instance\n */\n constructor(tf, opts) {\n\n //calls function before col operation\n this.onBeforeOperation = Types.isFn(opts.on_before_operation) ?\n opts.on_before_operation : null;\n //calls function after col operation\n this.onAfterOperation = Types.isFn(opts.on_after_operation) ?\n opts.on_after_operation : null;\n\n this.opts = opts;\n this.tf = tf;\n }\n\n init(){\n this.calc();\n }\n\n /**\n * Calculates columns' values\n * Configuration options are stored in 'opts' property\n * - 'id' contains ids of elements showing result (array)\n * - 'col' contains the columns' indexes (array)\n * - 'operation' contains operation type (array, values: 'sum', 'mean',\n * 'min', 'max', 'median', 'q1', 'q3')\n * - 'write_method' array defines which method to use for displaying the\n * result (innerHTML, setValue, createTextNode) - default: 'innerHTML'\n * - 'tot_row_index' defines in which row results are displayed\n * (integers array)\n *\n * - changes made by Nuovella:\n * (1) optimized the routine (now it will only process each column once),\n * (2) added calculations for the median, lower and upper quartile.\n */\n calc() {\n var tf = this.tf;\n if(!tf.isFirstLoad && !tf.hasGrid()){\n return;\n }\n\n if(this.onBeforeOperation){\n this.onBeforeOperation.call(null, tf);\n }\n\n var opts = this.opts,\n labelId = opts.id,\n colIndex = opts.col,\n operation = opts.operation,\n outputType = opts.write_method,\n totRowIndex = opts.tot_row_index,\n excludeRow = opts.exclude_row,\n decimalPrecision = Types.isUndef(opts.decimal_precision) ?\n 2 : opts.decimal_precision;\n\n //nuovella: determine unique list of columns to operate on\n var ucolIndex = [],\n ucolMax = 0;\n ucolIndex[ucolMax] = colIndex[0];\n\n for(var ii=1; ii maxValue ?\n parseFloat( cvalue ): maxValue;\n }\n }\n }\n }//for j\n if(meanFlag===1){\n meanValue = sumValue/nbvalues;\n }\n if(medFlag===1){\n var aux = 0;\n if(nbvalues%2 === 1){\n aux = Math.floor(nbvalues/2);\n medValue = theList[aux];\n } else{\n medValue =\n (theList[nbvalues/2] + theList[((nbvalues/2)-1)])/2;\n }\n }\n var posa;\n if(q1Flag===1){\n posa=0.0;\n posa = Math.floor(nbvalues/4);\n if(4*posa == nbvalues){\n q1Value = (theList[posa-1] + theList[posa])/2;\n } else {\n q1Value = theList[posa];\n }\n }\n if (q3Flag===1){\n posa=0.0;\n var posb=0.0;\n posa = Math.floor(nbvalues/4);\n if (4*posa === nbvalues){\n posb = 3*posa;\n q3Value = (theList[posb] + theList[posb-1])/2;\n } else {\n q3Value = theList[nbvalues-posa-1];\n }\n }\n\n for(var i=0; i<=mThisCol; i++){\n switch( opsThisCol[i] ){\n case 'mean':\n result=meanValue;\n break;\n case 'sum':\n result=sumValue;\n break;\n case 'min':\n result=minValue;\n break;\n case 'max':\n result=maxValue;\n break;\n case 'median':\n result=medValue;\n break;\n case 'q1':\n result=q1Value;\n break;\n case 'q3':\n result=q3Value;\n break;\n }\n\n var precision = !isNaN(decThisCol[i]) ? decThisCol[i] : 2;\n\n //if outputType is defined\n if(oTypeThisCol && result){\n result = result.toFixed( precision );\n\n if(Dom.id(labThisCol[i])){\n switch( Str.lower(oTypeThisCol) ){\n case 'innerhtml':\n if (isNaN(result) || !isFinite(result) ||\n nbvalues===0){\n Dom.id(labThisCol[i]).innerHTML = '.';\n } else{\n Dom.id(labThisCol[i]).innerHTML= result;\n }\n break;\n case 'setvalue':\n Dom.id( labThisCol[i] ).value = result;\n break;\n case 'createtextnode':\n var oldnode = Dom.id(labThisCol[i])\n .firstChild;\n var txtnode = Dom.text(result);\n Dom.id(labThisCol[i])\n .replaceChild(txtnode, oldnode);\n break;\n }//switch\n }\n } else {\n try{\n if(isNaN(result) || !isFinite(result) ||\n nbvalues===0){\n Dom.id(labThisCol[i]).innerHTML = '.';\n } else {\n Dom.id(labThisCol[i]).innerHTML =\n result.toFixed(precision);\n }\n } catch(e) {}//catch\n }//else\n }//for i\n\n // row(s) with result are always visible\n var totRow = totRowIndex && totRowIndex[ucol] ?\n rows[totRowIndex[ucol]] : null;\n if(totRow){\n totRow.style.display = '';\n }\n }//for ucol\n }//if typeof\n\n if(this.onAfterOperation){\n this.onAfterOperation.call(null, tf);\n }\n }\n\n destroy(){}\n\n}\n" }, { "kind": "class", "static": true, "variation": null, "name": "ColOps", "memberof": "src/extensions/colOps/colOps.js", "longname": "src/extensions/colOps/colOps.js~ColOps", "access": null, "export": true, "importPath": "TableFilter/src/extensions/colOps/colOps.js", "importStyle": "ColOps", "description": null, "lineNumber": 5, "undocument": true, "interface": false }, { "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/extensions/colOps/colOps.js~ColOps", "longname": "src/extensions/colOps/colOps.js~ColOps#constructor", "access": null, "description": "Column calculations", "lineNumber": 11, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "tf", "description": "TableFilter instance" } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "onBeforeOperation", "memberof": "src/extensions/colOps/colOps.js~ColOps", "longname": "src/extensions/colOps/colOps.js~ColOps#onBeforeOperation", "access": null, "description": null, "lineNumber": 14, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "onAfterOperation", "memberof": "src/extensions/colOps/colOps.js~ColOps", "longname": "src/extensions/colOps/colOps.js~ColOps#onAfterOperation", "access": null, "description": null, "lineNumber": 17, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "opts", "memberof": "src/extensions/colOps/colOps.js~ColOps", "longname": "src/extensions/colOps/colOps.js~ColOps#opts", "access": null, "description": null, "lineNumber": 20, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "tf", "memberof": "src/extensions/colOps/colOps.js~ColOps", "longname": "src/extensions/colOps/colOps.js~ColOps#tf", "access": null, "description": null, "lineNumber": 21, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "init", "memberof": "src/extensions/colOps/colOps.js~ColOps", "longname": "src/extensions/colOps/colOps.js~ColOps#init", "access": null, "description": null, "lineNumber": 24, "undocument": true, "params": [], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "calc", "memberof": "src/extensions/colOps/colOps.js~ColOps", "longname": "src/extensions/colOps/colOps.js~ColOps#calc", "access": null, "description": "Calculates columns' values\nConfiguration options are stored in 'opts' property\n- 'id' contains ids of elements showing result (array)\n- 'col' contains the columns' indexes (array)\n- 'operation' contains operation type (array, values: 'sum', 'mean',\n 'min', 'max', 'median', 'q1', 'q3')\n- 'write_method' array defines which method to use for displaying the\n result (innerHTML, setValue, createTextNode) - default: 'innerHTML'\n- 'tot_row_index' defines in which row results are displayed\n (integers array)\n\n- changes made by Nuovella:\n(1) optimized the routine (now it will only process each column once),\n(2) added calculations for the median, lower and upper quartile.", "lineNumber": 44, "params": [], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "destroy", "memberof": "src/extensions/colOps/colOps.js~ColOps", "longname": "src/extensions/colOps/colOps.js~ColOps#destroy", "access": null, "description": null, "lineNumber": 313, "undocument": true, "params": [], "generator": false }, { "kind": "file", "static": true, "variation": null, "name": "src/extensions/colsVisibility/colsVisibility.js", "memberof": null, "longname": "src/extensions/colsVisibility/colsVisibility.js", "access": null, "description": null, "lineNumber": 1, "content": "import Dom from '../../dom';\nimport Types from '../../types';\nimport Event from '../../event';\nimport Arr from '../../array';\n\nexport default class ColsVisibility{\n\n /**\n * Columns Visibility extension\n * @param {Object} tf TableFilter instance\n * @param {Object} f Config\n */\n constructor(tf, f){\n\n // Configuration object\n var cfg = tf.config();\n\n this.initialized = false;\n this.name = f.name;\n this.desc = f.description || 'Columns visibility manager';\n\n //show/hide cols span element\n this.spanEl = null;\n //show/hide cols button element\n this.btnEl = null;\n //show/hide cols container div element\n this.contEl = null;\n\n //tick to hide or show column\n this.tickToHide = f.tick_to_hide===false ? false : true;\n //enables/disables cols manager generation\n this.manager = f.manager===false ? false : true;\n //only if external headers\n this.headersTbl = f.headers_table || false;\n //only if external headers\n this.headersIndex = f.headers_index || 1;\n //id of container element\n this.contElTgtId = f.container_target_id || null;\n //alternative headers text\n this.headersText = f.headers_text || null;\n //id of button container element\n this.btnTgtId = f.btn_target_id || null;\n //defines show/hide cols text\n this.btnText = f.btn_text || 'Columns▼';\n //defines show/hide cols button innerHtml\n this.btnHtml = f.btn_html || null;\n //defines css class for show/hide cols button\n this.btnCssClass = f.btn_css_class || 'colVis';\n //defines close link text\n this.btnCloseText = f.btn_close_text || 'Close';\n //defines close button innerHtml\n this.btnCloseHtml = f.btn_close_html || null;\n //defines css class for close button\n this.btnCloseCssClass = f.btn_close_css_class || this.btnCssClass;\n this.stylesheet = f.stylesheet || 'colsVisibility.css';\n //span containing show/hide cols button\n this.prfx = 'colVis_';\n //defines css class span containing show/hide cols\n this.spanCssClass = f.span_css_class || 'colVisSpan';\n this.prfxCont = this.prfx + 'Cont_';\n //defines css class div containing show/hide cols\n this.contCssClass = f.cont_css_class || 'colVisCont';\n //defines css class for cols list (ul)\n this.listCssClass = cfg.list_css_class ||'cols_checklist';\n //defines css class for list item (li)\n this.listItemCssClass = cfg.checklist_item_css_class ||\n 'cols_checklist_item';\n //defines css class for selected list item (li)\n this.listSlcItemCssClass = cfg.checklist_selected_item_css_class ||\n 'cols_checklist_slc_item';\n //text preceding columns list\n this.text = f.text || (this.tickToHide ? 'Hide: ' : 'Show: ');\n this.atStart = f.at_start || null;\n this.enableHover = Boolean(f.enable_hover);\n //enables select all option\n this.enableTickAll = Boolean(f.enable_tick_all);\n //text preceding columns list\n this.tickAllText = f.tick_all_text || 'Select all:';\n\n //array containing hidden columns indexes\n this.hiddenCols = [];\n this.tblHasColTag = (Dom.tag(tf.tbl,'col').length > 0);\n\n //callback invoked just after cols manager is loaded\n this.onLoaded = Types.isFn(f.on_loaded) ? f.on_loaded : null;\n //calls function before cols manager is opened\n this.onBeforeOpen = Types.isFn(f.on_before_open) ?\n f.on_before_open : null;\n //calls function after cols manager is opened\n this.onAfterOpen = Types.isFn(f.on_after_open) ? f.on_after_open : null;\n //calls function before cols manager is closed\n this.onBeforeClose = Types.isFn(f.on_before_close) ?\n f.on_before_close : null;\n //calls function after cols manager is closed\n this.onAfterClose = Types.isFn(f.on_after_close) ?\n f.on_after_close : null;\n\n //callback before col is hidden\n this.onBeforeColHidden = Types.isFn(f.on_before_col_hidden) ?\n f.on_before_col_hidden : null;\n //callback after col is hidden\n this.onAfterColHidden = Types.isFn(f.on_after_col_hidden) ?\n f.on_after_col_hidden : null;\n //callback before col is displayed\n this.onBeforeColDisplayed = Types.isFn(f.on_before_col_displayed) ?\n f.on_before_col_displayed : null;\n //callback after col is displayed\n this.onAfterColDisplayed = Types.isFn(f.on_after_col_displayed) ?\n f.on_after_col_displayed : null;\n\n //Grid layout compatibility\n if(tf.gridLayout){\n this.headersTbl = tf.feature('gridLayout').headTbl; //headers table\n this.headersIndex = 0; //headers index\n this.onAfterColDisplayed = function(){};\n this.onAfterColHidden = function(){};\n }\n\n //Loads extension stylesheet\n tf.import(f.name+'Style', tf.stylePath + this.stylesheet, null, 'link');\n\n this.tf = tf;\n }\n\n toggle(){\n var contDisplay = this.contEl.style.display;\n var onBeforeOpen = this.onBeforeOpen;\n var onBeforeClose = this.onBeforeClose;\n var onAfterOpen = this.onAfterOpen;\n var onAfterClose = this.onAfterClose;\n\n if(onBeforeOpen && contDisplay !== 'inline'){\n onBeforeOpen.call(null, this);\n }\n if(onBeforeClose && contDisplay === 'inline'){\n onBeforeClose.call(null, this);\n }\n\n this.contEl.style.display = contDisplay === 'inline' ?\n 'none' : 'inline';\n\n if(onAfterOpen && contDisplay !== 'inline'){\n onAfterOpen.call(null, this);\n }\n if(onAfterClose && contDisplay === 'inline'){\n onAfterClose.call(null, this);\n }\n }\n\n checkItem(lbl){\n var li = lbl.parentNode;\n if(!li || !lbl){\n return;\n }\n var isChecked = lbl.firstChild.checked;\n var colIndex = lbl.firstChild.getAttribute('id').split('_')[1];\n colIndex = parseInt(colIndex, 10);\n if(isChecked){\n Dom.addClass(li, this.listSlcItemCssClass);\n } else {\n Dom.removeClass(li, this.listSlcItemCssClass);\n }\n\n var hide = false;\n if((this.tickToHide && isChecked) || (!this.tickToHide && !isChecked)){\n hide = true;\n }\n this.setHidden(colIndex, hide);\n }\n\n init(){\n if(!this.manager){\n return;\n }\n this.buildBtn();\n this.buildManager();\n\n this.initialized = true;\n }\n\n /**\n * Build main button UI\n */\n buildBtn(){\n if(this.btnEl){\n return;\n }\n var tf = this.tf;\n var span = Dom.create('span', ['id', this.prfx+tf.id]);\n span.className = this.spanCssClass;\n\n //Container element (rdiv or custom element)\n if(!this.btnTgtId){\n tf.setToolbar();\n }\n var targetEl = !this.btnTgtId ? tf.rDiv : Dom.id(this.btnTgtId);\n\n if(!this.btnTgtId){\n var firstChild = targetEl.firstChild;\n firstChild.parentNode.insertBefore(span, firstChild);\n } else {\n targetEl.appendChild(span);\n }\n\n if(!this.btnHtml){\n var btn = Dom.create('a', ['href','javascript:;']);\n btn.className = this.btnCssClass;\n btn.title = this.desc;\n\n btn.innerHTML = this.btnText;\n span.appendChild(btn);\n if(!this.enableHover){\n Event.add(btn, 'click', (evt)=> { this.toggle(evt); });\n } else {\n Event.add(btn, 'mouseover', (evt)=> { this.toggle(evt); });\n }\n } else { //Custom html\n span.innerHTML = this.btnHtml;\n var colVisEl = span.firstChild;\n if(!this.enableHover){\n Event.add(colVisEl, 'click', (evt)=> { this.toggle(evt); });\n } else {\n Event.add(colVisEl, 'mouseover', (evt)=> { this.toggle(evt); });\n }\n }\n\n this.spanEl = span;\n this.btnEl = this.spanEl.firstChild;\n\n if(this.onLoaded){\n this.onLoaded.call(null, this);\n }\n }\n\n /**\n * Build columns manager UI\n */\n buildManager(){\n var tf = this.tf;\n\n var container = !this.contElTgtId ?\n Dom.create('div', ['id', this.prfxCont+tf.id]) :\n Dom.id(this.contElTgtId);\n container.className = this.contCssClass;\n\n //Extension description\n var extNameLabel = Dom.create('p');\n extNameLabel.innerHTML = this.text;\n container.appendChild(extNameLabel);\n\n //Headers list\n var ul = Dom.create('ul' ,['id', 'ul'+this.name+'_'+tf.id]);\n ul.className = this.listCssClass;\n\n var tbl = this.headersTbl ? this.headersTbl : tf.tbl;\n var headerIndex = this.headersTbl ?\n this.headersIndex : tf.getHeadersRowIndex();\n var headerRow = tbl.rows[headerIndex];\n\n //Tick all option\n if(this.enableTickAll){\n var li = Dom.createCheckItem(\n 'col__'+tf.id, this.tickAllText, this.tickAllText);\n Dom.addClass(li, this.listItemCssClass);\n ul.appendChild(li);\n li.check.checked = !this.tickToHide;\n\n Event.add(li.check, 'click', ()=> {\n for(var h = 0; h < headerRow.cells.length; h++){\n var itm = Dom.id('col_'+h+'_'+tf.id);\n if(itm && li.check.checked !== itm.checked){\n itm.click();\n itm.checked = li.check.checked;\n }\n }\n });\n }\n\n for(var i = 0; i < headerRow.cells.length; i++){\n var cell = headerRow.cells[i];\n var cellText = this.headersText && this.headersText[i] ?\n this.headersText[i] : this._getHeaderText(cell);\n var liElm = Dom.createCheckItem(\n 'col_'+i+'_'+tf.id, cellText, cellText);\n Dom.addClass(liElm, this.listItemCssClass);\n if(!this.tickToHide){\n Dom.addClass(liElm, this.listSlcItemCssClass);\n }\n ul.appendChild(liElm);\n if(!this.tickToHide){\n liElm.check.checked = true;\n }\n\n Event.add(liElm.check, 'click', (evt)=> {\n var elm = Event.target(evt);\n var lbl = elm.parentNode;\n this.checkItem(lbl);\n });\n }\n\n //separator\n var p = Dom.create('p', ['align','center']);\n var btn;\n //Close link\n if(!this.btnCloseHtml){\n btn = Dom.create('a', ['href','javascript:;']);\n btn.className = this.btnCloseCssClass;\n btn.innerHTML = this.btnCloseText;\n Event.add(btn, 'click', (evt)=> { this.toggle(evt); });\n p.appendChild(btn);\n } else {\n p.innerHTML = this.btnCloseHtml;\n btn = p.firstChild;\n Event.add(btn, 'click', (evt)=> { this.toggle(evt); });\n }\n\n container.appendChild(ul);\n container.appendChild(p);\n\n this.btnEl.parentNode.insertBefore(container, this.btnEl);\n this.contEl = container;\n\n if(this.atStart){\n var a = this.atStart;\n for(var k=0; k';\n this.icnCollapseHtml = '\"Collapse';\n this.defaultText = 'Toggle filters';\n\n //id of container element\n this.targetId = f.target_id || null;\n //enables/disables expand/collapse icon\n this.enableIcon = f.enable_icon===false ? false : true;\n this.btnText = f.btn_text || '';\n\n //defines expand/collapse filters text\n this.collapseBtnHtml = this.enableIcon ?\n this.icnCollapseHtml + this.btnText :\n this.btnText || this.defaultText;\n this.expandBtnHtml = this.enableIcon ?\n this.icnExpandHtml + this.btnText :\n this.btnText || this.defaultText;\n\n //defines expand/collapse filters button innerHtml\n this.btnHtml = f.btn_html || null;\n //defines css class for expand/collapse filters button\n this.btnCssClass = f.btn_css_class || 'btnExpClpFlt';\n //defines css class span containing expand/collapse filters\n this.contCssClass = f.cont_css_class || 'expClpFlt';\n this.filtersRowIndex = !Types.isUndef(f.filters_row_index) ?\n f.filters_row_index : tf.getFiltersRowIndex();\n\n this.visibleAtStart = !Types.isUndef(f.visible_at_start) ?\n Boolean(f.visible_at_start) : true;\n\n // Prefix\n this.prfx = 'fltsVis_';\n\n //callback before filters row is shown\n this.onBeforeShow = Types.isFn(f.on_before_show) ?\n f.on_before_show : null;\n //callback after filters row is shown\n this.onAfterShow = Types.isFn(f.on_after_show) ?\n f.on_after_show : null;\n //callback before filters row is hidden\n this.onBeforeHide = Types.isFn(f.on_before_hide) ?\n f.on_before_hide : null;\n //callback after filters row is hidden\n this.onAfterHide = Types.isFn(f.on_after_hide) ? f.on_after_hide : null;\n\n //Loads extension stylesheet\n tf.import(f.name+'Style', tf.stylePath + this.stylesheet, null, 'link');\n\n this.tf = tf;\n }\n\n /**\n * Initialise extension\n */\n init(){\n if(this.initialized){\n return;\n }\n\n this.buildUI();\n this.initialized = true;\n }\n\n /**\n * Build UI elements\n */\n buildUI(){\n let tf = this.tf;\n let span = Dom.create('span',['id', this.prfx+tf.id]);\n span.className = this.contCssClass;\n\n //Container element (rdiv or custom element)\n if(!this.targetId){\n tf.setToolbar();\n }\n let targetEl = !this.targetId ? tf.rDiv : Dom.id(this.targetId);\n\n if(!this.targetId){\n let firstChild = targetEl.firstChild;\n firstChild.parentNode.insertBefore(span, firstChild);\n } else {\n targetEl.appendChild(span);\n }\n\n let btn;\n if(!this.btnHtml){\n btn = Dom.create('a', ['href', 'javascript:void(0);']);\n btn.className = this.btnCssClass;\n btn.title = this.btnText || this.defaultText;\n btn.innerHTML = this.collapseBtnHtml;\n span.appendChild(btn);\n Event.add(btn, 'click', ()=> this.toggle());\n } else { //Custom html\n span.innerHTML = this.btnHtml;\n btn = span.firstChild;\n Event.add(btn, 'click', ()=> this.toggle());\n }\n\n this.contEl = span;\n this.btnEl = btn;\n\n if(!this.visibleAtStart){\n this.toggle();\n }\n }\n\n /**\n * Toggle filters visibility\n */\n toggle(){\n let tf = this.tf;\n let tbl = tf.gridLayout? tf.feature('gridLayout').headTbl : tf.tbl;\n let fltRow = tbl.rows[this.filtersRowIndex];\n let fltRowDisplay = fltRow.style.display;\n\n if(this.onBeforeShow && fltRowDisplay !== ''){\n this.onBeforeShow.call(this, this);\n }\n if(this.onBeforeHide && fltRowDisplay === ''){\n this.onBeforeHide.call(null, this);\n }\n\n fltRow.style.display = fltRowDisplay==='' ? 'none' : '';\n if(this.enableIcon && !this.btnHtml){\n this.btnEl.innerHTML = fltRowDisplay === '' ?\n this.expandBtnHtml : this.collapseBtnHtml;\n }\n\n if(this.onAfterShow && fltRowDisplay !== ''){\n this.onAfterShow.call(null, this);\n }\n if(this.onAfterHide && fltRowDisplay === ''){\n this.onAfterHide.call(null, this);\n }\n }\n\n /**\n * Destroy the UI\n */\n destroy(){\n if(!this.btnEl && !this.contEl){\n return;\n }\n\n this.btnEl.innerHTML = '';\n this.btnEl.parentNode.removeChild(this.btnEl);\n this.btnEl = null;\n\n this.contEl.innerHTML = '';\n this.contEl.parentNode.removeChild(this.contEl);\n this.contEl = null;\n this.initialized = false;\n }\n\n}\n" }, { "kind": "class", "static": true, "variation": null, "name": "FiltersVisibility", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "access": null, "export": true, "importPath": "TableFilter/src/extensions/filtersVisibility/filtersVisibility.js", "importStyle": "FiltersVisibility", "description": null, "lineNumber": 5, "undocument": true, "interface": false }, { "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#constructor", "access": null, "description": "Filters Row Visibility extension", "lineNumber": 12, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "tf", "description": "TableFilter instance" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "f", "description": "Config" } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "initialized", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#initialized", "access": null, "description": null, "lineNumber": 14, "undocument": true, "type": { "types": [ "boolean" ] } }, { "kind": "member", "static": false, "variation": null, "name": "name", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#name", "access": null, "description": null, "lineNumber": 15, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "desc", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#desc", "access": null, "description": null, "lineNumber": 16, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "stylesheet", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#stylesheet", "access": null, "description": null, "lineNumber": 19, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "icnExpand", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#icnExpand", "access": null, "description": null, "lineNumber": 20, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "icnCollapse", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#icnCollapse", "access": null, "description": null, "lineNumber": 21, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "contEl", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#contEl", "access": null, "description": null, "lineNumber": 24, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnEl", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#btnEl", "access": null, "description": null, "lineNumber": 26, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "icnExpandHtml", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#icnExpandHtml", "access": null, "description": null, "lineNumber": 28, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "icnCollapseHtml", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#icnCollapseHtml", "access": null, "description": null, "lineNumber": 30, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "defaultText", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#defaultText", "access": null, "description": null, "lineNumber": 32, "undocument": true, "type": { "types": [ "string" ] } }, { "kind": "member", "static": false, "variation": null, "name": "targetId", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#targetId", "access": null, "description": null, "lineNumber": 35, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "enableIcon", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#enableIcon", "access": null, "description": null, "lineNumber": 37, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnText", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#btnText", "access": null, "description": null, "lineNumber": 38, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "collapseBtnHtml", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#collapseBtnHtml", "access": null, "description": null, "lineNumber": 41, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "expandBtnHtml", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#expandBtnHtml", "access": null, "description": null, "lineNumber": 44, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnHtml", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#btnHtml", "access": null, "description": null, "lineNumber": 49, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnCssClass", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#btnCssClass", "access": null, "description": null, "lineNumber": 51, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "contCssClass", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#contCssClass", "access": null, "description": null, "lineNumber": 53, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "filtersRowIndex", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#filtersRowIndex", "access": null, "description": null, "lineNumber": 54, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "visibleAtStart", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#visibleAtStart", "access": null, "description": null, "lineNumber": 57, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "prfx", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#prfx", "access": null, "description": null, "lineNumber": 61, "undocument": true, "type": { "types": [ "string" ] } }, { "kind": "member", "static": false, "variation": null, "name": "onBeforeShow", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#onBeforeShow", "access": null, "description": null, "lineNumber": 64, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "onAfterShow", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#onAfterShow", "access": null, "description": null, "lineNumber": 67, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "onBeforeHide", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#onBeforeHide", "access": null, "description": null, "lineNumber": 70, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "onAfterHide", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#onAfterHide", "access": null, "description": null, "lineNumber": 73, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "tf", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#tf", "access": null, "description": null, "lineNumber": 78, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "init", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#init", "access": null, "description": "Initialise extension", "lineNumber": 84, "params": [], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "initialized", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#initialized", "access": null, "description": null, "lineNumber": 90, "undocument": true, "type": { "types": [ "boolean" ] } }, { "kind": "method", "static": false, "variation": null, "name": "buildUI", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#buildUI", "access": null, "description": "Build UI elements", "lineNumber": 96, "params": [], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "contEl", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#contEl", "access": null, "description": null, "lineNumber": 128, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnEl", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#btnEl", "access": null, "description": null, "lineNumber": 129, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "toggle", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#toggle", "access": null, "description": "Toggle filters visibility", "lineNumber": 139, "params": [], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "destroy", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#destroy", "access": null, "description": "Destroy the UI", "lineNumber": 169, "params": [], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "btnEl", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#btnEl", "access": null, "description": null, "lineNumber": 176, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "contEl", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#contEl", "access": null, "description": null, "lineNumber": 180, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "initialized", "memberof": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility", "longname": "src/extensions/filtersVisibility/filtersVisibility.js~FiltersVisibility#initialized", "access": null, "description": null, "lineNumber": 181, "undocument": true, "type": { "types": [ "boolean" ] } }, { "kind": "file", "static": true, "variation": null, "name": "src/extensions/sort/adapterSortabletable.js", "memberof": null, "longname": "src/extensions/sort/adapterSortabletable.js", "access": null, "description": null, "lineNumber": 1, "content": "import Types from '../../types';\nimport Dom from '../../dom';\nimport Arr from '../../array';\nimport Event from '../../event';\nimport DateHelper from '../../date';\nimport Helpers from '../../helpers';\n\nexport default class AdapterSortableTable{\n\n /**\n * SortableTable Adapter module\n * @param {Object} tf TableFilter instance\n */\n constructor(tf, opts){\n // Configuration object\n let f = tf.config();\n\n this.initialized = false;\n this.name = opts.name;\n this.desc = opts.description || 'Sortable table';\n\n //indicates if paging is enabled\n this.isPaged = false;\n\n //indicates if tables was sorted\n this.sorted = false;\n\n this.sortTypes = Types.isArray(opts.types) ? opts.types : [];\n this.sortColAtStart = Types.isArray(opts.sort_col_at_start) ?\n opts.sort_col_at_start : null;\n this.asyncSort = Boolean(opts.async_sort);\n this.triggerIds = Types.isArray(opts.trigger_ids) ?\n opts.trigger_ids : [];\n\n // edit .sort-arrow.descending / .sort-arrow.ascending in\n // tablefilter.css to reflect any path change\n this.imgPath = opts.images_path || tf.themesPath;\n this.imgBlank = opts.image_blank || 'blank.png';\n this.imgClassName = opts.image_class_name || 'sort-arrow';\n this.imgAscClassName = opts.image_asc_class_name || 'ascending';\n this.imgDescClassName = opts.image_desc_class_name ||'descending';\n //cell attribute storing custom key\n this.customKey = opts.custom_key || 'data-tf-sortKey';\n\n /*** TF additional events ***/\n //additional paging events for alternating background\n // o.Evt._Paging.nextEvt = function(){\n // if(o.sorted && o.alternateBgs) o.Filter();\n // }\n // o.Evt._Paging.prevEvt = o.Evt._Paging.nextEvt;\n // o.Evt._Paging.firstEvt = o.Evt._Paging.nextEvt;\n // o.Evt._Paging.lastEvt = o.Evt._Paging.nextEvt;\n // o.Evt._OnSlcPagesChangeEvt = o.Evt._Paging.nextEvt;\n\n // callback invoked after sort is loaded and instanciated\n this.onSortLoaded = Types.isFn(opts.on_sort_loaded) ?\n opts.on_sort_loaded : null;\n // callback invoked before table is sorted\n this.onBeforeSort = Types.isFn(opts.on_before_sort) ?\n opts.on_before_sort : null;\n // callback invoked after table is sorted\n this.onAfterSort = Types.isFn(opts.on_after_sort) ?\n f.on_after_sort : null;\n\n this.tf = tf;\n }\n\n init(){\n let tf = this.tf;\n let adpt = this;\n\n // SortableTable class sanity check (sortabletable.js)\n if(Types.isUndef(SortableTable)){\n throw new Error('SortableTable class not found.');\n }\n\n this.overrideSortableTable();\n this.setSortTypes();\n\n //Column sort at start\n let sortColAtStart = adpt.sortColAtStart;\n if(sortColAtStart){\n this.stt.sort(sortColAtStart[0], sortColAtStart[1]);\n }\n\n if(this.onSortLoaded){\n this.onSortLoaded.call(null, tf, this);\n }\n\n /*** SortableTable callbacks ***/\n this.stt.onbeforesort = function(){\n if(this.onBeforeSort){\n this.onBeforeSort.call(null, tf, this.stt.sortColumn);\n }\n\n /*** sort behaviour for paging ***/\n if(tf.paging){\n adpt.isPaged = true;\n tf.paging = false;\n tf.feature('paging').destroy();\n }\n };\n\n this.stt.onsort = function(){\n adpt.sorted = true;\n\n //rows alternating bg issue\n // TODO: move into AlternateRows component\n if(tf.alternateBgs){\n let rows = tf.tbl.rows, c = 0;\n\n let setClass = function(row, i, removeOnly){\n if(Types.isUndef(removeOnly)){\n removeOnly = false;\n }\n let altRows = tf.feature('alternateRows'),\n oddCls = altRows.oddCss,\n evenCls = altRows.evenCss;\n Dom.removeClass(row, oddCls);\n Dom.removeClass(row, evenCls);\n\n if(!removeOnly){\n Dom.addClass(row, i % 2 ? oddCls : evenCls);\n }\n };\n\n for (let i = tf.refRow; i < tf.nbRows; i++){\n let isRowValid = rows[i].getAttribute('validRow');\n if(tf.paging && rows[i].style.display === ''){\n setClass(rows[i], c);\n c++;\n } else {\n if((isRowValid==='true' || isRowValid===null) &&\n rows[i].style.display === ''){\n setClass(rows[i], c);\n c++;\n } else {\n setClass(rows[i], c, true);\n }\n }\n }\n }\n //sort behaviour for paging\n if(adpt.isPaged){\n let paginator = tf.feature('paging');\n paginator.reset(false);\n paginator.setPage(paginator.getPage());\n adpt.isPaged = false;\n }\n\n if(adpt.onAfterSort){\n adpt.onAfterSort.call(null, tf, tf.stt.sortColumn);\n }\n };\n\n this.initialized = true;\n }\n\n /**\n * Sort specified column\n * @param {Number} colIdx Column index\n */\n sortByColumnIndex(colIdx){\n this.stt.sort(colIdx);\n }\n\n overrideSortableTable(){\n let adpt = this,\n tf = this.tf;\n\n /**\n * Overrides headerOnclick method in order to handle th event\n * @param {Object} e [description]\n */\n SortableTable.prototype.headerOnclick = function(evt){\n if(!adpt.initialized){\n return;\n }\n\n // find Header element\n let el = evt.target || evt.srcElement;\n\n while(el.tagName !== 'TD' && el.tagName !== 'TH'){\n el = el.parentNode;\n }\n\n this.sort(\n SortableTable.msie ?\n SortableTable.getCellIndex(el) : el.cellIndex\n );\n };\n\n /**\n * Overrides getCellIndex IE returns wrong cellIndex when columns are\n * hidden\n * @param {Object} oTd TD element\n * @return {Number} Cell index\n */\n SortableTable.getCellIndex = function(oTd){\n let cells = oTd.parentNode.cells,\n l = cells.length, i;\n for (i = 0; cells[i] != oTd && i < l; i++){}\n return i;\n };\n\n /**\n * Overrides initHeader in order to handle filters row position\n * @param {Array} oSortTypes\n */\n SortableTable.prototype.initHeader = function(oSortTypes){\n let stt = this;\n if (!stt.tHead){\n if(tf.gridLayout){\n stt.tHead = tf.feature('gridLayout').headTbl.tHead;\n } else {\n return;\n }\n }\n\n stt.headersRow = tf.headersRow;\n let cells = stt.tHead.rows[stt.headersRow].cells;\n stt.sortTypes = oSortTypes || [];\n let l = cells.length;\n let img, c;\n\n for (let i = 0; i < l; i++) {\n c = cells[i];\n if (stt.sortTypes[i] !== null && stt.sortTypes[i] !== 'None'){\n c.style.cursor = 'pointer';\n img = Dom.create('img',\n ['src', adpt.imgPath + adpt.imgBlank]);\n c.appendChild(img);\n if (stt.sortTypes[i] !== null){\n c.setAttribute( '_sortType', stt.sortTypes[i]);\n }\n Event.add(c, 'click', stt._headerOnclick);\n } else {\n c.setAttribute('_sortType', oSortTypes[i]);\n c._sortType = 'None';\n }\n }\n stt.updateHeaderArrows();\n };\n\n /**\n * Overrides updateHeaderArrows in order to handle arrows indicators\n */\n SortableTable.prototype.updateHeaderArrows = function(){\n let stt = this;\n let cells, l, img;\n\n // external headers\n if(adpt.asyncSort && adpt.triggerIds.length > 0){\n let triggers = adpt.triggerIds;\n cells = [];\n l = triggers.length;\n for(let j=0; j 0){\n let triggers = this.triggerIds;\n for(let j=0; j {\n let elm = evt.target;\n if(!this.tf.sort){\n return;\n }\n this.stt.asyncSort(\n Arr.indexByValue(triggers, elm.id, true)\n );\n });\n trigger.setAttribute('_sortType', _sortTypes[j]);\n }\n }\n }\n }\n\n /**\n * Destroy sort\n */\n destroy(){\n let tf = this.tf;\n this.sorted = false;\n this.initialized = false;\n this.stt.destroy();\n\n let ids = tf.getFiltersId();\n for (let idx = 0; idx < ids.length; idx++){\n let header = tf.getHeaderElement(idx);\n let img = Dom.tag(header, 'img');\n\n if(img.length === 1){\n header.removeChild(img[0]);\n }\n }\n }\n\n}\n\n//Converters\nfunction usNumberConverter(s){\n return Helpers.removeNbFormat(s, 'us');\n}\nfunction euNumberConverter(s){\n return Helpers.removeNbFormat(s, 'eu');\n}\nfunction dateConverter(s, format){\n return DateHelper.format(s, format);\n}\nfunction dmyDateConverter(s){\n return dateConverter(s, 'DMY');\n}\nfunction mdyDateConverter(s){\n return dateConverter(s, 'MDY');\n}\nfunction ymdDateConverter(s){\n return dateConverter(s, 'YMD');\n}\nfunction ddmmmyyyyDateConverter(s){\n return dateConverter(s, 'DDMMMYYYY');\n}\n\nfunction ipAddress(value){\n let vals = value.split('.');\n for (let x in vals) {\n let val = vals[x];\n while (3 > val.length){\n val = '0'+val;\n }\n vals[x] = val;\n }\n return vals.join('.');\n}\n\nfunction sortIP(a,b){\n let aa = ipAddress(a.value.toLowerCase());\n let bb = ipAddress(b.value.toLowerCase());\n if (aa==bb){\n return 0;\n } else if (aa { this.onChange(evt); });\n\n var rows = tf.tbl.rows;\n this.isCustom = tf.isCustomOptions(colIndex);\n\n var activeFlt;\n if(tf.linkedFilters && tf.activeFilterId){\n activeFlt = tf.activeFilterId.split('_')[0];\n activeFlt = activeFlt.split(tf.prfxFlt)[1];\n }\n\n var filteredDataCol = [];\n if(tf.linkedFilters && tf.disableExcludedOptions){\n this.excludedOpts = [];\n }\n\n for(var k=tf.refRow; k 0){\n if(tf.hasCustomSlcOptions &&\n Arr.has(tf.customSlcOptions.cols, colIndex)){\n fltArr.push(tmpVal);\n } else {\n fltArr = tmpVal.split(' '+tf.orOperator+' ');\n }\n }\n\n for(var y=0; y { this.optionClick(evt); });\n }\n ul.appendChild(li);\n\n if(val===''){\n //item is hidden\n li.style.display = 'none';\n }\n\n /*** remember grid values ***/\n if(tf.rememberGridValues){\n if((tf.hasCustomSlcOptions &&\n Arr.has(tf.customSlcOptions.cols, colIndex) &&\n fltArr.toString().indexOf(val)!= -1) ||\n Arr.has(fltArr,\n Str.matchCase(val, tf.matchCase), tf.matchCase)){\n li.check.checked = true;\n this.setCheckListValues(li.check);\n }\n }\n }\n }\n\n /**\n * Add checklist header option\n * @param {Number} colIndex Column index\n * @param {Object} ul Ul element\n */\n addTChecks(colIndex, ul){\n var tf = this.tf;\n var chkCt = 1;\n var li0 = Dom.createCheckItem(\n tf.fltIds[colIndex]+'_0', '', tf.displayAllText);\n li0.className = this.checkListItemCssClass;\n ul.appendChild(li0);\n\n Event.add(li0.check, 'click', (evt) => {\n this.optionClick(evt);\n });\n\n if(!this.enableCheckListResetFilter){\n li0.style.display = 'none';\n }\n\n if(tf.enableEmptyOption){\n var li1 = Dom.createCheckItem(\n tf.fltIds[colIndex]+'_1', tf.emOperator, tf.emptyText);\n li1.className = this.checkListItemCssClass;\n ul.appendChild(li1);\n Event.add(li1.check, 'click', (evt) => {\n this.optionClick(evt);\n });\n chkCt++;\n }\n\n if(tf.enableNonEmptyOption){\n var li2 = Dom.createCheckItem(\n tf.fltIds[colIndex]+'_2',\n tf.nmOperator,\n tf.nonEmptyText\n );\n li2.className = this.checkListItemCssClass;\n ul.appendChild(li2);\n Event.add(li2.check, 'click', (evt) => {\n this.optionClick(evt);\n });\n chkCt++;\n }\n return chkCt;\n }\n\n /**\n * Store checked options in DOM element attribute\n * @param {Object} o checklist option DOM element\n */\n setCheckListValues(o){\n if(!o){\n return;\n }\n var tf = this.tf;\n var chkValue = o.value; //checked item value\n var chkIndex = parseInt(o.id.split('_')[2], 10);\n var filterTag = 'ul', itemTag = 'li';\n var n = o;\n\n //ul tag search\n while(Str.lower(n.nodeName)!==filterTag){\n n = n.parentNode;\n }\n\n var li = n.childNodes[chkIndex];\n var colIndex = n.getAttribute('colIndex');\n var fltValue = n.getAttribute('value'); //filter value (ul tag)\n var fltIndexes = n.getAttribute('indexes'); //selected items (ul tag)\n\n if(o.checked){\n //show all item\n if(chkValue===''){\n if((fltIndexes && fltIndexes!=='')){\n //items indexes\n var indSplit = fltIndexes.split(tf.separator);\n //checked items loop\n for(var u=0; u');\n //span containing reset button\n this.prfxResetSpan = 'resetspan_';\n\n this.tf = tf;\n }\n\n onClick(){\n this.tf.clearFilters();\n }\n\n /**\n * Build DOM elements\n */\n init(){\n var tf = this.tf;\n\n if(!tf.hasGrid() && !tf.isFirstLoad && tf.btnResetEl){\n return;\n }\n\n var resetspan = Dom.create('span', ['id', this.prfxResetSpan+tf.id]);\n\n // reset button is added to defined element\n if(!this.btnResetTgtId){\n tf.setToolbar();\n }\n var targetEl = !this.btnResetTgtId ?\n tf.rDiv : Dom.id(this.btnResetTgtId);\n targetEl.appendChild(resetspan);\n\n if(!this.btnResetHtml){\n var fltreset = Dom.create('a', ['href', 'javascript:void(0);']);\n fltreset.className = tf.btnResetCssClass;\n fltreset.appendChild(Dom.text(this.btnResetText));\n resetspan.appendChild(fltreset);\n // fltreset.onclick = this.Evt._Clear;\n Event.add(fltreset, 'click', () => { this.onClick(); });\n } else {\n resetspan.innerHTML = this.btnResetHtml;\n var resetEl = resetspan.firstChild;\n // resetEl.onclick = this.Evt._Clear;\n Event.add(resetEl, 'click', () => { this.onClick(); });\n }\n this.btnResetEl = resetspan.firstChild;\n }\n\n /**\n * Remove clear button UI\n */\n destroy(){\n var tf = this.tf;\n\n if(!tf.hasGrid() || !this.btnResetEl){\n return;\n }\n\n var resetspan = Dom.id(tf.prfxResetSpan+tf.id);\n if(resetspan){\n resetspan.parentNode.removeChild(resetspan);\n }\n this.btnResetEl = null;\n }\n}\n" }, { "kind": "class", "static": true, "variation": null, "name": "ClearButton", "memberof": "src/modules/clearButton.js", "longname": "src/modules/clearButton.js~ClearButton", "access": null, "export": true, "importPath": "TableFilter/src/modules/clearButton.js", "importStyle": "{ClearButton}", "description": null, "lineNumber": 4, "undocument": true, "interface": false }, { "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#constructor", "access": null, "description": "Clear button component", "lineNumber": 10, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "tf", "description": "TableFilter instance" } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "btnResetTgtId", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#btnResetTgtId", "access": null, "description": null, "lineNumber": 15, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnResetEl", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#btnResetEl", "access": null, "description": null, "lineNumber": 17, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnResetText", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#btnResetText", "access": null, "description": null, "lineNumber": 19, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnResetTooltip", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#btnResetTooltip", "access": null, "description": null, "lineNumber": 21, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnResetHtml", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#btnResetHtml", "access": null, "description": null, "lineNumber": 23, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "prfxResetSpan", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#prfxResetSpan", "access": null, "description": null, "lineNumber": 28, "undocument": true, "type": { "types": [ "string" ] } }, { "kind": "member", "static": false, "variation": null, "name": "tf", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#tf", "access": null, "description": null, "lineNumber": 30, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "onClick", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#onClick", "access": null, "description": null, "lineNumber": 33, "undocument": true, "params": [], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "init", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#init", "access": null, "description": "Build DOM elements", "lineNumber": 40, "params": [], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "btnResetEl", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#btnResetEl", "access": null, "description": null, "lineNumber": 70, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "destroy", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#destroy", "access": null, "description": "Remove clear button UI", "lineNumber": 76, "params": [], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "btnResetEl", "memberof": "src/modules/clearButton.js~ClearButton", "longname": "src/modules/clearButton.js~ClearButton#btnResetEl", "access": null, "description": null, "lineNumber": 87, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "file", "static": true, "variation": null, "name": "src/modules/dropdown.js", "memberof": null, "longname": "src/modules/dropdown.js", "access": null, "description": null, "lineNumber": 1, "content": "import Dom from '../dom';\nimport Arr from '../array';\nimport Str from '../string';\nimport Sort from '../sort';\n\nexport class Dropdown{\n\n /**\n * Dropdown UI component\n * @param {Object} tf TableFilter instance\n */\n constructor(tf){\n // Configuration object\n var f = tf.config();\n\n this.enableSlcResetFilter = f.enable_slc_reset_filter===false ?\n false : true;\n //defines empty option text\n this.nonEmptyText = f.non_empty_text || '(Non empty)';\n //sets select filling method: 'innerHTML' or 'createElement'\n this.slcFillingMethod = f.slc_filling_method || 'createElement';\n //IE only, tooltip text appearing on select before it is populated\n this.activateSlcTooltip = f.activate_slc_tooltip ||\n 'Click to activate';\n //tooltip text appearing on multiple select\n this.multipleSlcTooltip = f.multiple_slc_tooltip ||\n 'Use Ctrl key for multiple selections';\n\n this.isCustom = null;\n this.opts = null;\n this.optsTxt = null;\n this.slcInnerHtml = null;\n\n this.tf = tf;\n }\n\n /**\n * Build drop-down filter UI asynchronously\n * @param {Number} colIndex Column index\n * @param {Boolean} isLinked Enable linked refresh behaviour\n * @param {Boolean} isExternal Render in external container\n * @param {String} extSlcId External container id\n */\n build(colIndex, isLinked, isExternal, extSlcId){\n var tf = this.tf;\n tf.EvtManager(\n tf.Evt.name.dropdown,\n {\n slcIndex: colIndex,\n slcRefreshed: isLinked,\n slcExternal: isExternal,\n slcId: extSlcId\n }\n );\n }\n\n /**\n * Build drop-down filter UI\n * @param {Number} colIndex Column index\n * @param {Boolean} isLinked Enable linked refresh behaviour\n * @param {Boolean} isExternal Render in external container\n * @param {String} extSlcId External container id\n */\n _build(colIndex, isLinked=false, isExternal=false, extSlcId=null){\n var tf = this.tf;\n colIndex = parseInt(colIndex, 10);\n\n this.opts = [];\n this.optsTxt = [];\n this.slcInnerHtml = '';\n\n var slcId = tf.fltIds[colIndex];\n if((!Dom.id(slcId) && !isExternal) ||\n (!Dom.id(extSlcId) && isExternal)){\n return;\n }\n var slc = !isExternal ? Dom.id(slcId) : Dom.id(extSlcId),\n rows = tf.tbl.rows,\n matchCase = tf.matchCase;\n\n //custom select test\n this.isCustom = tf.isCustomOptions(colIndex);\n\n //custom selects text\n var activeFlt;\n if(isLinked && tf.activeFilterId){\n activeFlt = tf.activeFilterId.split('_')[0];\n activeFlt = activeFlt.split(tf.prfxFlt)[1];\n }\n\n /*** remember grid values ***/\n var fltsValues = [], fltArr = [];\n if(tf.rememberGridValues){\n fltsValues =\n tf.feature('store').getFilterValues(tf.fltsValuesCookie);\n if(fltsValues && !Str.isEmpty(fltsValues.toString())){\n if(this.isCustom){\n fltArr.push(fltsValues[colIndex]);\n } else {\n fltArr = fltsValues[colIndex].split(' '+tf.orOperator+' ');\n }\n }\n }\n\n var excludedOpts = null,\n filteredDataCol = null;\n if(isLinked && tf.disableExcludedOptions){\n excludedOpts = [];\n filteredDataCol = [];\n }\n\n for(var k=tf.refRow; k' +\n lbl+'';\n } else {\n var opt;\n //fill select on demand\n if(tf.loadFltOnDemand && slcValue===this.opts[y] &&\n tf['col'+colIndex]===tf.fltTypeSlc){\n opt = Dom.createOpt(lbl, val, true);\n } else {\n if(tf['col'+colIndex]!==tf.fltTypeMulti){\n opt = Dom.createOpt(\n lbl,\n val,\n (fltsValues[colIndex]!==' ' &&\n val===fltsValues[colIndex]) ? true : false\n );\n } else {\n opt = Dom.createOpt(\n lbl,\n val,\n (Arr.has(fltArr,\n Str.matchCase(this.opts[y], tf.matchCase),\n tf.matchCase) ||\n fltArr.toString().indexOf(val)!== -1) ?\n true : false\n );\n }\n }\n if(isDisabled){\n opt.disabled = true;\n }\n slc.appendChild(opt);\n }\n }// for y\n\n if(fillMethod === 'innerhtml'){\n slc.innerHTML += this.slcInnerHtml;\n }\n slc.setAttribute('filled', '1');\n }\n\n /**\n * Add drop-down header option\n * @param {Object} slc Select DOM element\n */\n addFirstOption(slc){\n var tf = this.tf,\n fillMethod = Str.lower(this.slcFillingMethod);\n\n if(fillMethod === 'innerhtml'){\n this.slcInnerHtml += '';\n }\n else {\n var opt0 = Dom.createOpt(\n (!this.enableSlcResetFilter ? '' : tf.displayAllText),'');\n if(!this.enableSlcResetFilter){\n opt0.style.display = 'none';\n }\n slc.appendChild(opt0);\n if(tf.enableEmptyOption){\n var opt1 = Dom.createOpt(tf.emptyText, tf.emOperator);\n slc.appendChild(opt1);\n }\n if(tf.enableNonEmptyOption){\n var opt2 = Dom.createOpt(tf.nonEmptyText, tf.nmOperator);\n slc.appendChild(opt2);\n }\n }\n return slc;\n }\n\n}\n" }, { "kind": "class", "static": true, "variation": null, "name": "Dropdown", "memberof": "src/modules/dropdown.js", "longname": "src/modules/dropdown.js~Dropdown", "access": null, "export": true, "importPath": "TableFilter/src/modules/dropdown.js", "importStyle": "{Dropdown}", "description": null, "lineNumber": 6, "undocument": true, "interface": false }, { "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#constructor", "access": null, "description": "Dropdown UI component", "lineNumber": 12, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "tf", "description": "TableFilter instance" } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "enableSlcResetFilter", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#enableSlcResetFilter", "access": null, "description": null, "lineNumber": 16, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "nonEmptyText", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#nonEmptyText", "access": null, "description": null, "lineNumber": 19, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "slcFillingMethod", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#slcFillingMethod", "access": null, "description": null, "lineNumber": 21, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "activateSlcTooltip", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#activateSlcTooltip", "access": null, "description": null, "lineNumber": 23, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "multipleSlcTooltip", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#multipleSlcTooltip", "access": null, "description": null, "lineNumber": 26, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "isCustom", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#isCustom", "access": null, "description": null, "lineNumber": 29, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "opts", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#opts", "access": null, "description": null, "lineNumber": 30, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "optsTxt", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#optsTxt", "access": null, "description": null, "lineNumber": 31, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "slcInnerHtml", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#slcInnerHtml", "access": null, "description": null, "lineNumber": 32, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "tf", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#tf", "access": null, "description": null, "lineNumber": 34, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "build", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#build", "access": null, "description": "Build drop-down filter UI asynchronously", "lineNumber": 44, "params": [ { "nullable": null, "types": [ "Number" ], "spread": false, "optional": false, "name": "colIndex", "description": "Column index" }, { "nullable": null, "types": [ "Boolean" ], "spread": false, "optional": false, "name": "isLinked", "description": "Enable linked refresh behaviour" }, { "nullable": null, "types": [ "Boolean" ], "spread": false, "optional": false, "name": "isExternal", "description": "Render in external container" }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "extSlcId", "description": "External container id" } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "_build", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#_build", "access": null, "description": "Build drop-down filter UI", "lineNumber": 64, "params": [ { "nullable": null, "types": [ "Number" ], "spread": false, "optional": false, "name": "colIndex", "description": "Column index" }, { "nullable": null, "types": [ "Boolean" ], "spread": false, "optional": false, "name": "isLinked", "description": "Enable linked refresh behaviour" }, { "nullable": null, "types": [ "Boolean" ], "spread": false, "optional": false, "name": "isExternal", "description": "Render in external container" }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "extSlcId", "description": "External container id" } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "opts", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#opts", "access": null, "description": null, "lineNumber": 68, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "optsTxt", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#optsTxt", "access": null, "description": null, "lineNumber": 69, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "slcInnerHtml", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#slcInnerHtml", "access": null, "description": null, "lineNumber": 70, "undocument": true, "type": { "types": [ "string" ] } }, { "kind": "member", "static": false, "variation": null, "name": "isCustom", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#isCustom", "access": null, "description": null, "lineNumber": 82, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "opts", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#opts", "access": null, "description": null, "lineNumber": 169, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "optsTxt", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#optsTxt", "access": null, "description": null, "lineNumber": 170, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "addOptions", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#addOptions", "access": null, "description": "Add drop-down options", "lineNumber": 240, "params": [ { "nullable": null, "types": [ "Number" ], "spread": false, "optional": false, "name": "colIndex", "description": "Column index" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "slc", "description": "Select Dom element" }, { "nullable": null, "types": [ "Boolean" ], "spread": false, "optional": false, "name": "isLinked", "description": "Enable linked refresh behaviour" }, { "nullable": null, "types": [ "Array" ], "spread": false, "optional": false, "name": "excludedOpts", "description": "Array of excluded options" }, { "nullable": null, "types": [ "Array" ], "spread": false, "optional": false, "name": "fltsValues", "description": "Collection of persisted filter values" }, { "nullable": null, "types": [ "Array" ], "spread": false, "optional": false, "name": "fltArr", "description": "Collection of persisted filter values" } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "slcInnerHtml", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#slcInnerHtml", "access": null, "description": null, "lineNumber": 269, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "addFirstOption", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#addFirstOption", "access": null, "description": "Add drop-down header option", "lineNumber": 315, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "slc", "description": "Select DOM element" } ], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "slcInnerHtml", "memberof": "src/modules/dropdown.js~Dropdown", "longname": "src/modules/dropdown.js~Dropdown#slcInnerHtml", "access": null, "description": null, "lineNumber": 320, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "file", "static": true, "variation": null, "name": "src/modules/gridLayout.js", "memberof": null, "longname": "src/modules/gridLayout.js", "access": null, "description": null, "lineNumber": 1, "content": "import Dom from '../dom';\nimport Types from '../types';\nimport Event from '../event';\n\nexport class GridLayout{\n\n /**\n * Grid layout, table with fixed headers\n * @param {Object} tf TableFilter instance\n */\n constructor(tf) {\n var f = tf.config();\n\n //defines grid width\n this.gridWidth = f.grid_width || null;\n //defines grid height\n this.gridHeight = f.grid_height || null;\n //defines css class for main container\n this.gridMainContCssClass = f.grid_cont_css_class || 'grd_Cont';\n //defines css class for div containing table\n this.gridContCssClass = f.grid_tbl_cont_css_class || 'grd_tblCont';\n //defines css class for div containing headers' table\n this.gridHeadContCssClass = f.grid_tblHead_cont_css_class ||\n 'grd_headTblCont';\n //defines css class for div containing rows counter, paging etc.\n this.gridInfDivCssClass = f.grid_inf_grid_css_class || 'grd_inf';\n //defines which row contains column headers\n this.gridHeadRowIndex = f.grid_headers_row_index || 0;\n //array of headers row indexes to be placed in header table\n this.gridHeadRows = f.grid_headers_rows || [0];\n //generate filters in table headers\n this.gridEnableFilters = f.grid_enable_default_filters!==undefined ?\n f.grid_enable_default_filters : true;\n //default col width\n this.gridDefaultColWidth = f.grid_default_col_width || '100px';\n //enables/disables columns resizer\n // this.gridEnableColResizer = f.grid_enable_cols_resizer!==undefined ?\n // f.grid_enable_cols_resizer : false;\n // //defines col resizer script path\n // this.gridColResizerPath = f.grid_cont_col_resizer_path ||\n // this.basePath+'TFExt_ColsResizer/TFExt_ColsResizer.js';\n\n this.gridColElms = [];\n\n //div containing grid elements if grid_layout true\n this.prfxMainTblCont = 'gridCont_';\n //div containing table if grid_layout true\n this.prfxTblCont = 'tblCont_';\n //div containing headers table if grid_layout true\n this.prfxHeadTblCont = 'tblHeadCont_';\n //headers' table if grid_layout true\n this.prfxHeadTbl = 'tblHead_';\n //id of td containing the filter if grid_layout true\n this.prfxGridFltTd = '_td_';\n //id of th containing column header if grid_layout true\n this.prfxGridTh = 'tblHeadTh_';\n\n this.tf = tf;\n }\n\n /**\n * Generates a grid with fixed headers\n */\n init(){\n var tf = this.tf;\n var f = tf.config();\n var tbl = tf.tbl;\n\n if(!tf.gridLayout){\n return;\n }\n\n tf.isExternalFlt = true;\n\n // default width of 100px if column widths not set\n if(!tf.hasColWidths){\n tf.colWidths = [];\n for(var k=0; k0){\n tbl.removeChild(thead[0]);\n }\n\n //Headers table style\n this.headTbl.style.tableLayout = 'fixed';\n tbl.style.tableLayout = 'fixed';\n this.headTbl.cellPadding = tbl.cellPadding;\n this.headTbl.cellSpacing = tbl.cellSpacing;\n // this.headTbl.style.width = tbl.style.width;\n\n //content table without headers needs col widths to be reset\n tf.setColWidths(0, this.headTbl);\n\n //Headers container width\n // this.headTblCont.style.width = this.tblCont.clientWidth+'px';\n\n tbl.style.width = '';\n //\n this.headTbl.style.width = tbl.clientWidth + 'px';\n //\n\n //scroll synchronisation\n Event.add(this.tblCont, 'scroll', (evt)=> {\n var elm = Event.target(evt);\n var scrollLeft = elm.scrollLeft;\n this.headTblCont.scrollLeft = scrollLeft;\n //New pointerX calc taking into account scrollLeft\n // if(!o.isPointerXOverwritten){\n // try{\n // o.Evt.pointerX = function(evt){\n // var e = evt || global.event;\n // var bdScrollLeft = tf_StandardBody().scrollLeft +\n // scrollLeft;\n // return (e.pageX + scrollLeft) ||\n // (e.clientX + bdScrollLeft);\n // };\n // o.isPointerXOverwritten = true;\n // } catch(err) {\n // o.isPointerXOverwritten = false;\n // }\n // }\n });\n\n //Configure sort extension if any\n var sort = (f.extensions || []).filter(function(itm){\n return itm.name === 'sort';\n });\n if(sort.length === 1){\n sort[0].async_sort = true;\n sort[0].trigger_ids = sortTriggers;\n }\n\n //Cols generation for all browsers excepted IE<=7\n this.tblHasColTag = Dom.tag(tbl, 'col').length > 0 ? true : false;\n\n //Col elements are enough to keep column widths after sorting and\n //filtering\n var createColTags = function(){\n for(var k=(tf.nbCells-1); k>=0; k--){\n var col = Dom.create('col', ['id', tf.id+'_col_'+k]);\n tbl.insertBefore(col, tbl.firstChild);\n col.style.width = tf.colWidths[k];\n this.gridColElms[k] = col;\n }\n this.tblHasColTag = true;\n };\n\n if(!this.tblHasColTag){\n createColTags.call(this);\n } else {\n var cols = Dom.tag(tbl, 'col');\n for(var ii=0; ii<, <=, >, ' +\n '>=, =, *, !, {, }, ' +\n '||,&&, [empty], [nonempty], ' +\n 'rgx:
' +\n 'Learn more
';\n //defines help innerHtml\n this.instrHtml = f.help_instructions_html || null;\n //defines reset button text\n this.btnText = f.help_instructions_btn_text || '?';\n //defines reset button innerHtml\n this.btnHtml = f.help_instructions_btn_html || null;\n //defines css class for help button\n this.btnCssClass = f.help_instructions_btn_css_class || 'helpBtn';\n //defines css class for help container\n this.contCssClass = f.help_instructions_container_css_class ||\n 'helpCont';\n //help button element\n this.btn = null;\n //help content div\n this.cont = null;\n this.defaultHtml = '

TableFilter ' +\n 'v'+ tf.version +'

' +\n ''+ WEBSITE_URL +''+\n '
©2015-'+ tf.year +' {AUTHOR}' +\n '
' +\n 'Close
';\n\n //id prefix for help elements\n this.prfxHelpSpan = 'helpSpan_';\n //id prefix for help elements\n this.prfxHelpDiv = 'helpDiv_';\n\n this.tf = tf;\n }\n\n init(){\n if(this.btn){\n return;\n }\n\n var tf = this.tf;\n\n var helpspan = Dom.create('span',['id', this.prfxHelpSpan+tf.id]);\n var helpdiv = Dom.create('div',['id', this.prfxHelpDiv+tf.id]);\n\n //help button is added to defined element\n if(!this.tgtId){\n tf.setToolbar();\n }\n var targetEl = !this.tgtId ?\n tf.rDiv : Dom.id(this.tgtId);\n targetEl.appendChild(helpspan);\n\n var divContainer = !this.contTgtId ?\n helpspan : Dom.id(this.contTgtId);\n\n if(!this.btnHtml){\n divContainer.appendChild(helpdiv);\n var helplink = Dom.create('a', ['href', 'javascript:void(0);']);\n helplink.className = this.btnCssClass;\n helplink.appendChild(Dom.text(this.btnText));\n helpspan.appendChild(helplink);\n Event.add(helplink, 'click', () => { this.toggle(); });\n } else {\n helpspan.innerHTML = this.btnHtml;\n var helpEl = helpspan.firstChild;\n Event.add(helpEl, 'click', () => { this.toggle(); });\n divContainer.appendChild(helpdiv);\n }\n\n if(!this.instrHtml){\n helpdiv.innerHTML = this.instrText;\n helpdiv.className = this.contCssClass;\n Event.add(helpdiv, 'dblclick', () => { this.toggle(); });\n } else {\n if(this.contTgtId){\n divContainer.appendChild(helpdiv);\n }\n helpdiv.innerHTML = this.instrHtml;\n if(!this.contTgtId){\n helpdiv.className = this.contCssClass;\n Event.add(helpdiv, 'dblclick', () => { this.toggle(); });\n }\n }\n helpdiv.innerHTML += this.defaultHtml;\n Event.add(helpdiv, 'click', () => { this.toggle(); });\n\n this.cont = helpdiv;\n this.btn = helpspan;\n }\n\n /**\n * Toggle help pop-up\n */\n toggle(){\n if(!this.cont){\n return;\n }\n var divDisplay = this.cont.style.display;\n if(divDisplay === '' || divDisplay === 'none'){\n this.cont.style.display = 'inline';\n } else {\n this.cont.style.display = 'none';\n }\n }\n\n /**\n * Remove help UI\n */\n destroy(){\n if(!this.btn){\n return;\n }\n this.btn.parentNode.removeChild(this.btn);\n this.btn = null;\n if(!this.cont){\n return;\n }\n this.cont.parentNode.removeChild(this.cont);\n this.cont = null;\n }\n\n}\n" }, { "kind": "variable", "static": true, "variation": null, "name": "WIKI_URL", "memberof": "src/modules/help.js", "longname": "src/modules/help.js~WIKI_URL", "access": null, "export": false, "importPath": "TableFilter/src/modules/help.js", "importStyle": null, "description": null, "lineNumber": 5, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "variable", "static": true, "variation": null, "name": "WEBSITE_URL", "memberof": "src/modules/help.js", "longname": "src/modules/help.js~WEBSITE_URL", "access": null, "export": false, "importPath": "TableFilter/src/modules/help.js", "importStyle": null, "description": null, "lineNumber": 7, "undocument": true, "type": { "types": [ "string" ] } }, { "kind": "class", "static": true, "variation": null, "name": "Help", "memberof": "src/modules/help.js", "longname": "src/modules/help.js~Help", "access": null, "export": true, "importPath": "TableFilter/src/modules/help.js", "importStyle": "{Help}", "description": null, "lineNumber": 9, "undocument": true, "interface": false }, { "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#constructor", "access": null, "description": "Help UI component", "lineNumber": 15, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "tf", "description": "TableFilter instance" } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "tgtId", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#tgtId", "access": null, "description": null, "lineNumber": 20, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "contTgtId", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#contTgtId", "access": null, "description": null, "lineNumber": 22, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "instrText", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#instrText", "access": null, "description": null, "lineNumber": 25, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "instrHtml", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#instrHtml", "access": null, "description": null, "lineNumber": 35, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnText", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#btnText", "access": null, "description": null, "lineNumber": 37, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnHtml", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#btnHtml", "access": null, "description": null, "lineNumber": 39, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btnCssClass", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#btnCssClass", "access": null, "description": null, "lineNumber": 41, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "contCssClass", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#contCssClass", "access": null, "description": null, "lineNumber": 43, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btn", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#btn", "access": null, "description": null, "lineNumber": 46, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "cont", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#cont", "access": null, "description": null, "lineNumber": 48, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "defaultHtml", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#defaultHtml", "access": null, "description": null, "lineNumber": 49, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "prfxHelpSpan", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#prfxHelpSpan", "access": null, "description": null, "lineNumber": 57, "undocument": true, "type": { "types": [ "string" ] } }, { "kind": "member", "static": false, "variation": null, "name": "prfxHelpDiv", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#prfxHelpDiv", "access": null, "description": null, "lineNumber": 59, "undocument": true, "type": { "types": [ "string" ] } }, { "kind": "member", "static": false, "variation": null, "name": "tf", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#tf", "access": null, "description": null, "lineNumber": 61, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "init", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#init", "access": null, "description": null, "lineNumber": 64, "undocument": true, "params": [], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "cont", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#cont", "access": null, "description": null, "lineNumber": 116, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "btn", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#btn", "access": null, "description": null, "lineNumber": 117, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "toggle", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#toggle", "access": null, "description": "Toggle help pop-up", "lineNumber": 123, "params": [], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "destroy", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#destroy", "access": null, "description": "Remove help UI", "lineNumber": 138, "params": [], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "btn", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#btn", "access": null, "description": null, "lineNumber": 143, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "cont", "memberof": "src/modules/help.js~Help", "longname": "src/modules/help.js~Help#cont", "access": null, "description": null, "lineNumber": 148, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "file", "static": true, "variation": null, "name": "src/modules/highlightKeywords.js", "memberof": null, "longname": "src/modules/highlightKeywords.js", "access": null, "description": null, "lineNumber": 1, "content": "import Dom from '../dom';\nimport Str from '../string';\n\nexport class HighlightKeyword{\n\n /**\n * HighlightKeyword, highlight matched keyword\n * @param {Object} tf TableFilter instance\n */\n constructor(tf) {\n var f = tf.config();\n //defines css class for highlighting\n this.highlightCssClass = f.highlight_css_class || 'keyword';\n this.highlightedNodes = [];\n\n this.tf = tf;\n }\n\n /**\n * highlight occurences of searched term in passed node\n * @param {Node} node\n * @param {String} word Searched term\n * @param {String} cssClass Css class name\n */\n highlight(node, word, cssClass){\n // Iterate into this nodes childNodes\n if(node.hasChildNodes){\n var children = node.childNodes;\n for(var i=0; i {\n if(!this.loaderDiv){\n return;\n }\n if(this.onShowLoader && p!=='none'){\n this.onShowLoader.call(null, this);\n }\n this.loaderDiv.style.display = p;\n if(this.onHideLoader && p==='none'){\n this.onHideLoader.call(null, this);\n }\n };\n\n var t = p==='none' ? this.loaderCloseDelay : 1;\n global.setTimeout(displayLoader, t);\n }\n\n destroy(){\n if(!this.loaderDiv){\n return;\n }\n var tf = this.tf,\n targetEl = !this.loaderTgtId ?\n (tf.gridLayout ?\n tf.feature('gridLayout').tblCont : tf.tbl.parentNode):\n Dom.id(this.loaderTgtId);\n targetEl.removeChild(this.loaderDiv);\n this.loaderDiv = null;\n }\n}\n" }, { "kind": "variable", "static": true, "variation": null, "name": "global", "memberof": "src/modules/loader.js", "longname": "src/modules/loader.js~global", "access": null, "export": false, "importPath": "TableFilter/src/modules/loader.js", "importStyle": null, "description": null, "lineNumber": 4, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "class", "static": true, "variation": null, "name": "Loader", "memberof": "src/modules/loader.js", "longname": "src/modules/loader.js~Loader", "access": null, "export": true, "importPath": "TableFilter/src/modules/loader.js", "importStyle": "{Loader}", "description": null, "lineNumber": 6, "undocument": true, "interface": false }, { "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#constructor", "access": null, "description": "Loading message/spinner", "lineNumber": 12, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "tf", "description": "TableFilter instance" } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "loaderTgtId", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#loaderTgtId", "access": null, "description": null, "lineNumber": 17, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "loaderDiv", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#loaderDiv", "access": null, "description": null, "lineNumber": 19, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "loaderText", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#loaderText", "access": null, "description": null, "lineNumber": 21, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "loaderHtml", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#loaderHtml", "access": null, "description": null, "lineNumber": 23, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "loaderCssClass", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#loaderCssClass", "access": null, "description": null, "lineNumber": 25, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "loaderCloseDelay", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#loaderCloseDelay", "access": null, "description": null, "lineNumber": 27, "undocument": true, "type": { "types": [ "number" ] } }, { "kind": "member", "static": false, "variation": null, "name": "onShowLoader", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#onShowLoader", "access": null, "description": null, "lineNumber": 29, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "onHideLoader", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#onHideLoader", "access": null, "description": null, "lineNumber": 32, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "prfxLoader", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#prfxLoader", "access": null, "description": null, "lineNumber": 35, "undocument": true, "type": { "types": [ "string" ] } }, { "kind": "member", "static": false, "variation": null, "name": "tf", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#tf", "access": null, "description": null, "lineNumber": 37, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "loaderDiv", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#loaderDiv", "access": null, "description": null, "lineNumber": 49, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "show", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#show", "access": null, "description": null, "lineNumber": 57, "undocument": true, "params": [ { "name": "p", "types": [ "*" ] } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "destroy", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#destroy", "access": null, "description": null, "lineNumber": 80, "undocument": true, "params": [], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "loaderDiv", "memberof": "src/modules/loader.js~Loader", "longname": "src/modules/loader.js~Loader#loaderDiv", "access": null, "description": null, "lineNumber": 90, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "file", "static": true, "variation": null, "name": "src/modules/paging.js", "memberof": null, "longname": "src/modules/paging.js", "access": null, "description": null, "lineNumber": 1, "content": "import Dom from '../dom';\nimport Types from '../types';\nimport Str from '../string';\nimport Event from '../event';\n\nexport class Paging{\n\n /**\n * Pagination component\n * @param {Object} tf TableFilter instance\n */\n constructor(tf){\n // Configuration object\n var f = tf.config();\n\n //css class for paging buttons (previous,next,etc.)\n this.btnPageCssClass = f.paging_btn_css_class || 'pgInp';\n //stores paging select element\n this.pagingSlc = null;\n //results per page select element\n this.resultsPerPageSlc = null;\n //id of container element\n this.pagingTgtId = f.paging_target_id || null;\n //defines table paging length\n this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10;\n //id of container element\n this.resultsPerPageTgtId = f.results_per_page_target_id || null;\n //css class for paging select element\n this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc';\n //css class for paging input element\n this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp';\n //stores results per page text and values\n this.resultsPerPage = f.results_per_page || null;\n //enables/disables results per page drop-down\n this.hasResultsPerPage = Types.isArray(this.resultsPerPage);\n //defines css class for results per page select\n this.resultsSlcCssClass = f.results_slc_css_class || 'rspg';\n //css class for label preceding results per page select\n this.resultsSpanCssClass = f.results_span_css_class || 'rspgSpan';\n //1st row index of current page\n this.startPagingRow = 0;\n //total nb of pages\n this.nbPages = 0;\n //current page nb\n this.currentPageNb = 1;\n //defines next page button text\n this.btnNextPageText = f.btn_next_page_text || '>';\n //defines previous page button text\n this.btnPrevPageText = f.btn_prev_page_text || '<';\n //defines last page button text\n this.btnLastPageText = f.btn_last_page_text || '>|';\n //defines first page button text\n this.btnFirstPageText = f.btn_first_page_text || '|<';\n //defines next page button html\n this.btnNextPageHtml = f.btn_next_page_html ||\n (!tf.enableIcons ? null :\n '');\n //defines previous page button html\n this.btnPrevPageHtml = f.btn_prev_page_html ||\n (!tf.enableIcons ? null :\n '');\n //defines last page button html\n this.btnFirstPageHtml = f.btn_first_page_html ||\n (!tf.enableIcons ? null :\n '');\n //defines previous page button html\n this.btnLastPageHtml = f.btn_last_page_html ||\n (!tf.enableIcons ? null :\n '');\n //defines text preceeding page selector drop-down\n this.pageText = f.page_text || ' Page ';\n //defines text after page selector drop-down\n this.ofText = f.of_text || ' of ';\n //css class for span containing tot nb of pages\n this.nbPgSpanCssClass = f.nb_pages_css_class || 'nbpg';\n //enables/disables paging buttons\n this.hasPagingBtns = f.paging_btns===false ? false : true;\n //defines previous page button html\n this.pageSelectorType = f.page_selector_type || tf.fltTypeSlc;\n //calls function before page is changed\n this.onBeforeChangePage = Types.isFn(f.on_before_change_page) ?\n f.on_before_change_page : null;\n //calls function before page is changed\n this.onAfterChangePage = Types.isFn(f.on_after_change_page) ?\n f.on_after_change_page : null;\n\n //pages select\n this.prfxSlcPages = 'slcPages_';\n //results per page select\n this.prfxSlcResults = 'slcResults_';\n //label preciding results per page select\n this.prfxSlcResultsTxt = 'slcResultsTxt_';\n //span containing next page button\n this.prfxBtnNextSpan = 'btnNextSpan_';\n //span containing previous page button\n this.prfxBtnPrevSpan = 'btnPrevSpan_';\n //span containing last page button\n this.prfxBtnLastSpan = 'btnLastSpan_';\n //span containing first page button\n this.prfxBtnFirstSpan = 'btnFirstSpan_';\n //next button\n this.prfxBtnNext = 'btnNext_';\n //previous button\n this.prfxBtnPrev = 'btnPrev_';\n //last button\n this.prfxBtnLast = 'btnLast_';\n //first button\n this.prfxBtnFirst = 'btnFirst_';\n //span for tot nb pages\n this.prfxPgSpan = 'pgspan_';\n //span preceding pages select (contains 'Page')\n this.prfxPgBeforeSpan = 'pgbeforespan_';\n //span following pages select (contains ' of ')\n this.prfxPgAfterSpan = 'pgafterspan_';\n\n var start_row = this.refRow;\n var nrows = this.nbRows;\n //calculates page nb\n this.nbPages = Math.ceil((nrows-start_row)/this.pagingLength);\n\n //Paging elements events\n var o = this;\n // Paging DOM events\n this.evt = {\n slcIndex(){\n return (o.pageSelectorType===tf.fltTypeSlc) ?\n o.pagingSlc.options.selectedIndex :\n parseInt(o.pagingSlc.value, 10)-1;\n },\n nbOpts(){\n return (o.pageSelectorType===tf.fltTypeSlc) ?\n parseInt(o.pagingSlc.options.length, 10)-1 :\n (o.nbPages-1);\n },\n next(){\n var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ?\n o.evt.slcIndex()+1 : 0;\n o.changePage(nextIndex);\n },\n prev(){\n var prevIndex = o.evt.slcIndex()>0 ?\n o.evt.slcIndex()-1 : o.evt.nbOpts();\n o.changePage(prevIndex);\n },\n last(){\n o.changePage(o.evt.nbOpts());\n },\n first(){\n o.changePage(0);\n },\n _detectKey(e){\n var key = Event.keyCode(e);\n if(key===13){\n if(tf.sorted){\n tf.filter();\n o.changePage(o.evt.slcIndex());\n } else{\n o.changePage();\n }\n this.blur();\n }\n },\n slcPagesChange: null,\n nextEvt: null,\n prevEvt: null,\n lastEvt: null,\n firstEvt: null\n };\n\n this.tf = tf;\n }\n\n /**\n * Initialize DOM elements\n */\n init(){\n var slcPages;\n var tf = this.tf;\n var evt = this.evt;\n\n // Check resultsPerPage is in expected format and initialise the\n // results per page component\n if(this.hasResultsPerPage){\n if(this.resultsPerPage.length<2){\n this.hasResultsPerPage = false;\n } else {\n this.pagingLength = this.resultsPerPage[1][0];\n this.setResultsPerPage();\n }\n }\n\n evt.slcPagesChange = (event) => {\n var slc = event.target;\n this.changePage(slc.selectedIndex);\n };\n\n // Paging drop-down list selector\n if(this.pageSelectorType === tf.fltTypeSlc){\n slcPages = Dom.create(\n tf.fltTypeSlc, ['id', this.prfxSlcPages+tf.id]);\n slcPages.className = this.pgSlcCssClass;\n Event.add(slcPages, 'change', evt.slcPagesChange);\n }\n\n // Paging input selector\n if(this.pageSelectorType === tf.fltTypeInp){\n slcPages = Dom.create(\n tf.fltTypeInp,\n ['id', this.prfxSlcPages+tf.id],\n ['value', this.currentPageNb]\n );\n slcPages.className = this.pgInpCssClass;\n Event.add(slcPages, 'keypress', evt._detectKey);\n }\n\n // btns containers\n var btnNextSpan = Dom.create(\n 'span',['id', this.prfxBtnNextSpan+tf.id]);\n var btnPrevSpan = Dom.create(\n 'span',['id', this.prfxBtnPrevSpan+tf.id]);\n var btnLastSpan = Dom.create(\n 'span',['id', this.prfxBtnLastSpan+tf.id]);\n var btnFirstSpan = Dom.create(\n 'span',['id', this.prfxBtnFirstSpan+tf.id]);\n\n if(this.hasPagingBtns){\n // Next button\n if(!this.btnNextPageHtml){\n var btn_next = Dom.create(\n tf.fltTypeInp,\n ['id', this.prfxBtnNext+tf.id],\n ['type', 'button'],\n ['value', this.btnNextPageText],\n ['title', 'Next']\n );\n btn_next.className = this.btnPageCssClass;\n Event.add(btn_next, 'click', evt.next);\n btnNextSpan.appendChild(btn_next);\n } else {\n btnNextSpan.innerHTML = this.btnNextPageHtml;\n Event.add(btnNextSpan, 'click', evt.next);\n }\n // Previous button\n if(!this.btnPrevPageHtml){\n var btn_prev = Dom.create(\n tf.fltTypeInp,\n ['id', this.prfxBtnPrev+tf.id],\n ['type', 'button'],\n ['value', this.btnPrevPageText],\n ['title', 'Previous']\n );\n btn_prev.className = this.btnPageCssClass;\n Event.add(btn_prev, 'click', evt.prev);\n btnPrevSpan.appendChild(btn_prev);\n } else {\n btnPrevSpan.innerHTML = this.btnPrevPageHtml;\n Event.add(btnPrevSpan, 'click', evt.prev);\n }\n // Last button\n if(!this.btnLastPageHtml){\n var btn_last = Dom.create(\n tf.fltTypeInp,\n ['id', this.prfxBtnLast+tf.id],\n ['type', 'button'],\n ['value', this.btnLastPageText],\n ['title', 'Last']\n );\n btn_last.className = this.btnPageCssClass;\n Event.add(btn_last, 'click', evt.last);\n btnLastSpan.appendChild(btn_last);\n } else {\n btnLastSpan.innerHTML = this.btnLastPageHtml;\n Event.add(btnLastSpan, 'click', evt.last);\n }\n // First button\n if(!this.btnFirstPageHtml){\n var btn_first = Dom.create(\n tf.fltTypeInp,\n ['id', this.prfxBtnFirst+tf.id],\n ['type', 'button'],\n ['value', this.btnFirstPageText],\n ['title', 'First']\n );\n btn_first.className = this.btnPageCssClass;\n Event.add(btn_first, 'click', evt.first);\n btnFirstSpan.appendChild(btn_first);\n } else {\n btnFirstSpan.innerHTML = this.btnFirstPageHtml;\n Event.add(btnFirstSpan, 'click', evt.first);\n }\n }\n\n // paging elements (buttons+drop-down list) are added to defined element\n if(!this.pagingTgtId){\n tf.setToolbar();\n }\n var targetEl = !this.pagingTgtId ? tf.mDiv : Dom.id(this.pagingTgtId);\n targetEl.appendChild(btnFirstSpan);\n targetEl.appendChild(btnPrevSpan);\n\n var pgBeforeSpan = Dom.create(\n 'span',['id', this.prfxPgBeforeSpan+tf.id] );\n pgBeforeSpan.appendChild( Dom.text(this.pageText) );\n pgBeforeSpan.className = this.nbPgSpanCssClass;\n targetEl.appendChild(pgBeforeSpan);\n targetEl.appendChild(slcPages);\n var pgAfterSpan = Dom.create(\n 'span',['id', this.prfxPgAfterSpan+tf.id]);\n pgAfterSpan.appendChild( Dom.text(this.ofText) );\n pgAfterSpan.className = this.nbPgSpanCssClass;\n targetEl.appendChild(pgAfterSpan);\n var pgspan = Dom.create( 'span',['id', this.prfxPgSpan+tf.id] );\n pgspan.className = this.nbPgSpanCssClass;\n pgspan.appendChild( Dom.text(' '+this.nbPages+' ') );\n targetEl.appendChild(pgspan);\n targetEl.appendChild(btnNextSpan);\n targetEl.appendChild(btnLastSpan);\n this.pagingSlc = Dom.id(this.prfxSlcPages+tf.id);\n\n if(!tf.rememberGridValues || this.isPagingRemoved){\n this.setPagingInfo();\n }\n if(!tf.fltGrid){\n tf.validateAllRows();\n this.setPagingInfo(tf.validRowsIndex);\n }\n\n this.isPagingRemoved = false;\n }\n\n /**\n * Reset paging when filters are already instantiated\n * @param {Boolean} filterTable Execute filtering once paging instanciated\n */\n reset(filterTable=false){\n var tf = this.tf;\n if(!tf.hasGrid() || tf.paging){\n return;\n }\n tf.paging = true;\n this.isPagingRemoved = true;\n this.init();\n tf.resetValues();\n if(filterTable){\n tf.filter();\n }\n }\n\n /**\n * Calculate number of pages based on valid rows\n * Refresh paging select according to number of pages\n * @param {Array} validRows Collection of valid rows\n */\n setPagingInfo(validRows=[]){\n var tf = this.tf;\n var rows = tf.tbl.rows;\n var mdiv = !this.pagingTgtId ? tf.mDiv : Dom.id(this.pagingTgtId);\n var pgspan = Dom.id(this.prfxPgSpan+tf.id);\n\n //store valid rows indexes\n tf.validRowsIndex = validRows;\n\n if(validRows.length === 0){\n //counts rows to be grouped\n for(var j=tf.refRow; j0){\n mdiv.style.visibility = 'visible';\n if(this.pageSelectorType === tf.fltTypeSlc){\n for(var z=0; z