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

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

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