diff --git a/Gruntfile.js b/Gruntfile.js index 6e048886..5da2368f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,19 +8,6 @@ module.exports = function (grunt) { dist_folder: 'dist/', source_folder: 'src/', - // meta: { - // src: [ - // //'<%= source_folder %>string.js', - // // '<%= source_folder %>dom.js', - // // '<%= source_folder %>event.js', - // // '<%= source_folder %>types.js', - // // '<%= source_folder %>cookie.js', - // //'<%= source_folder %>array.js', - // // '<%= source_folder %>date.js', - // // '<%= source_folder %>core.js' - // ] - // }, - // A list of files, which will be syntax-checked by JSHint jshint: { src: ['Gruntfile.js', 'src/*.js'], @@ -47,14 +34,33 @@ module.exports = function (grunt) { tasks: ['dev'] }, + requirejs: { + compile: { + options: { + baseUrl: 'src/', + 'paths': { + 'tf': '.' + }, + include: ['../libs/almond/almond','core'], + out: 'dist/tablefilter.js', + wrap: { + startFile: "src/start.frag", + endFile: "src/end.frag" + }/*, + optimize: 'uglify2', + preserveLicenseComments: false, + generateSourceMaps: true*/ + } + } + }, + concat: { - js: { + /*js: { files: [{ - //src: ['<%= meta.src %>'], src: ['<%= source_folder %>core.js'], dest: '<%= dist_folder %>core.js' }] - }, + },*/ css: { files: [{ src: ['<%= source_folder %>filtergrid.css'], @@ -76,8 +82,8 @@ module.exports = function (grunt) { }, js: { - src: ['<%= concat.js.files[0].dest %>'], - dest: '<%= concat.js.files[0].dest %>' + src: ['<%= dist_folder %>tablefilter.js'], + dest: '<%= dist_folder %>tablefilter.js' } }, @@ -102,39 +108,23 @@ module.exports = function (grunt) { //{ src: ['<%= source_folder %>tablefilter_all.js'], dest: '<%= dist_folder %>tablefilter_all-uncompressed.js' }, //{ src: ['<%= source_folder %>tablefilter.js'], dest: '<%= dist_folder %>tablefilter-uncompressed.js' }, // { src: ['<%= source_folder %>filtergrid.css'], dest: '<%= dist_folder %>filtergrid-uncompressed.css' }, - { src: ['<%= source_folder %>tf-main.js'], dest: '<%= dist_folder %>tf-main.js' }, - { src: ['<%= source_folder %>string.js'], dest: '<%= dist_folder %>string.js' }, - { src: ['<%= source_folder %>array.js'], dest: '<%= dist_folder %>array.js' }, - { src: ['<%= source_folder %>cookie.js'], dest: '<%= dist_folder %>cookie.js' }, - { src: ['<%= source_folder %>date.js'], dest: '<%= dist_folder %>date.js' }, - { src: ['<%= source_folder %>dom.js'], dest: '<%= dist_folder %>dom.js' }, - { src: ['<%= source_folder %>event.js'], dest: '<%= dist_folder %>event.js' }, - { src: ['<%= source_folder %>types.js'], dest: '<%= dist_folder %>types.js' }, - { src: ['**'], cwd: '<%= source_folder %>modules/', dest: '<%= dist_folder %>modules/', expand: true }, + // { src: ['<%= source_folder %>tf-main.js'], dest: '<%= dist_folder %>tf-main.js' }, + // { src: ['<%= source_folder %>string.js'], dest: '<%= dist_folder %>string.js' }, + // { src: ['<%= source_folder %>array.js'], dest: '<%= dist_folder %>array.js' }, + // { src: ['<%= source_folder %>cookie.js'], dest: '<%= dist_folder %>cookie.js' }, + // { src: ['<%= source_folder %>date.js'], dest: '<%= dist_folder %>date.js' }, + // { src: ['<%= source_folder %>dom.js'], dest: '<%= dist_folder %>dom.js' }, + // { src: ['<%= source_folder %>event.js'], dest: '<%= dist_folder %>event.js' }, + // { src: ['<%= source_folder %>types.js'], dest: '<%= dist_folder %>types.js' }, + // { src: ['**'], cwd: '<%= source_folder %>modules/', dest: '<%= dist_folder %>modules/', expand: true }, // { src: ['<%= source_folder %>/*.js'], dest: '<%= dist_folder %>', flatten: true, expand: false }, - { src: ['libs/requirejs/require.js'], dest: '<%= dist_folder %>/libs/require.js' }, + // { src: ['libs/requirejs/require.js'], dest: '<%= dist_folder %>/libs/require.js' }, { src: ['**'], cwd: '<%= source_folder %>TF_Modules/', dest: '<%= dist_folder %>TF_Modules/', expand: true }, { src: ['**'], cwd: '<%= source_folder %>TF_Themes/', dest: '<%= dist_folder %>TF_Themes/', expand: true } ] } - }, - - requirejs: { - compile: { - options: { - baseUrl: 'src/', - 'paths': { - 'tf': '.' - }, - include: ['../libs/almond/almond','core'], - out: 'dist/tf.js', - wrap: { - startFile: "parts/start.frag", - endFile: "parts/end.frag" - } - } - } } + }); // Load the plugins that provide the tasks we specified in package.json. @@ -148,6 +138,6 @@ module.exports = function (grunt) { // This is the default task being executed if Grunt // is called without any further parameter. - grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'cssmin', 'copy', 'requirejs']); + grunt.registerTask('default', ['jshint', 'requirejs', 'concat', 'uglify', 'cssmin', 'copy']); grunt.registerTask('dev', ['jshint', 'concat', 'cssmin', 'copy']); }; \ No newline at end of file diff --git a/bower.json b/bower.json index 3ac13503..8286b3c9 100644 --- a/bower.json +++ b/bower.json @@ -6,8 +6,12 @@ "Max Guglielmi" ], "description": "Filter HTML tables data easily", - "main": ["dist/tablefilter_all.js", "dist/filtergrid.css"], + "main": [ + "dist/tablefilter_all.js", + "dist/filtergrid.css" + ], "moduleType": [ + "amd", "globals" ], "keywords": [ @@ -22,9 +26,11 @@ "node_modules", "bower_components", "test", - "tests" + "tests", + "libs" ], "dependencies": { + "almond": "~0.3.0", "requirejs": null } } diff --git a/dist/array.js b/dist/array.js deleted file mode 100644 index 737b011f..00000000 --- a/dist/array.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Array utilities - */ - -define(function (require) { - 'use strict'; - - var str = require('./string'); - - var Arr = { - has: function(arr, val, caseSensitive){ - var sCase = caseSensitive===undefined ? false : caseSensitive; - for (var i=0; i1)for(var b=0;b1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==e.filters_cell_tag||"td"!==e.filters_cell_tag?"td":e.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.tblData=[],this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.contDiv=null,this.infDivCssClass=e.inf_div_css_class||"inf",this.lDivCssClass=e.left_div_css_class||"ldiv",this.rDivCssClass=e.right_div_css_class||"rdiv",this.mDivCssClass=e.middle_div_css_class||"mdiv",this.contDivCssClass=e.content_div_css_class||"cont",this.stylesheet=e.stylesheet||this.basePath+"filtergrid.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=e.flts_row_css_class||"fltrow",this.enableIcons=e.enable_icons===!1?!1:!0,this.alternateBgs=e.alternate_rows===!0?!0:!1,this.hasColWidth=e.col_width===!0?!0:!1,this.colWidth=this.hasColWidth?e.col_width:null,this.fixedHeaders=e.fixed_headers===!0?!0:!1,this.tBodyH=isNaN(e.tbody_height)?200:e.tbody_height,this.fltCssClass=e.flt_css_class||"flt",this.fltMultiCssClass=e.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=e.flt_small_css_class||"flt_s",this.singleFltCssClass=e.single_flt_css_class||"single_flt",this.isStartBgAlternate=!0,this.rowBgEvenCssClass=e.even_row_css_class||"even",this.rowBgOddCssClass=e.odd_row_css_class||"odd",this.enterKey=e.enter_key===!1?!1:!0,this.isModFilterFn=e.mod_filter_fn===!0?!0:!1,this.modFilterFn=this.isModFilterFn?e.mod_filter_fn:null,this.onBeforeFilter=types.isFn(e.on_before_filter)?e.on_before_filter:null,this.onAfterFilter=types.isFn(e.on_after_filter)?e.on_after_filter:null,this.matchCase=e.match_case===!0?!0:!1,this.exactMatch=e.exact_match===!0?!0:!1,this.refreshFilters=e.refresh_filters===!0?!0:!1,this.disableExcludedOptions=e.disable_excluded_options===!0?!0:!1,this.activeFlt=null,this.activeFilterId=null,this.hasColOperation=e.col_operation===!0?!0:!1,this.colOperation=null,this.hasVisibleRows=e.rows_always_visible===!0?!0:!1,this.visibleRows=this.hasVisibleRows?e.rows_always_visible:[],this.searchType=e.search_type||"include",this.isExternalFlt=e.external_flt_grid===!0?!0:!1,this.externalFltTgtIds=e.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(e.exec_delay)?100:parseInt(e.exec_delay,10),this.status=e.status===!0?!0:!1,this.onFiltersLoaded=types.isFn(e.on_filters_loaded)?e.on_filters_loaded:null,this.singleSearchFlt=e.single_search_filter===!0?!0:!1,this.onRowValidated=types.isFn(e.on_row_validated)?e.on_row_validated:null,this.customCellDataCols=e.custom_cell_data_cols?e.custom_cell_data_cols:[],this.customCellData=types.isFn(e.custom_cell_data)?e.custom_cell_data:null,this.inpWatermark=e.input_watermark||"",this.inpWatermarkCssClass=e.input_watermark_css_class||"fltWatermark",this.isInpWatermarkArray=types.isArray(e.input_watermark),this.toolBarTgtId=e.toolbar_target_id||null,this.helpInstructions=e.help_instructions||null,this.popUpFilters=e.popup_filters===!0?!0:!1,this.markActiveColumns=e.mark_active_columns===!0?!0:!1,this.activeColumnsCssClass=e.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=types.isFn(e.on_before_active_column)?e.on_before_active_column:null,this.onAfterActiveColumn=types.isFn(e.on_after_active_column)?e.on_after_active_column:null,this.displayAllText=e.display_all_text||"",this.enableSlcResetFilter=e.enable_slc_reset_filter===!1?!1:!0,this.enableEmptyOption=e.enable_empty_option===!0?!0:!1,this.emptyText=e.empty_text||"(Empty)",this.enableNonEmptyOption=e.enable_non_empty_option===!0?!0:!1,this.nonEmptyText=e.non_empty_text||"(Non empty)",this.onSlcChange=e.on_change===!1?!1:!0,this.sortSlc=e.sort_select===!1?!1:!0,this.isSortNumAsc=e.sort_num_asc===!0?!0:!1,this.sortNumAsc=this.isSortNumAsc?e.sort_num_asc:null,this.isSortNumDesc=e.sort_num_desc===!0?!0:!1,this.sortNumDesc=this.isSortNumDesc?e.sort_num_desc:null,this.slcFillingMethod=e.slc_filling_method||"createElement",this.fillSlcOnDemand=e.fill_slc_on_demand===!0?!0:!1,this.activateSlcTooltip=e.activate_slc_tooltip||"Click to activate",this.multipleSlcTooltip=e.multiple_slc_tooltip||"Use Ctrl key for multiple selections",this.hasCustomSlcOptions=types.isObj(e.custom_slc_options)?!0:!1,this.customSlcOptions=types.isArray(e.custom_slc_options)?e.custom_slc_options:null,this.onBeforeOperation=types.isFn(e.on_before_operation)?e.on_before_operation:null,this.onAfterOperation=types.isFn(e.on_after_operation)?e.on_after_operation:null,this.checkListDiv=[],this.checkListDivCssClass=e.div_checklist_css_class||"div_checklist",this.checkListCssClass=e.checklist_css_class||"flt_checklist",this.checkListItemCssClass=e.checklist_item_css_class||"flt_checklist_item",this.checkListSlcItemCssClass=e.checklist_selected_item_css_class||"flt_checklist_slc_item",this.activateCheckListTxt=e.activate_checklist_text||"Click to load filter data",this.checkListItemDisabledCssClass=e.checklist_item_disabled_css_class||"flt_checklist_item_disabled",this.enableCheckListResetFilter=e.enable_checklist_reset_filter===!1?!1:!0,this.rgxOperator=e.regexp_operator||"rgx:",this.emOperator=e.empty_operator||"[empty]",this.nmOperator=e.nonempty_operator||"[nonempty]",this.orOperator=e.or_operator||"||",this.anOperator=e.and_operator||"&&",this.grOperator=e.greater_operator||">",this.lwOperator=e.lower_operator||"<",this.leOperator=e.lower_equal_operator||"<=",this.geOperator=e.greater_equal_operator||">=",this.dfOperator=e.different_operator||"!",this.lkOperator=e.like_operator||"*",this.eqOperator=e.equal_operator||"=",this.stOperator=e.start_with_operator||"{",this.enOperator=e.end_with_operator||"}",this.curExp=e.cur_exp||"^[¥£€$]",this.separator=e.separator||",",this.rowsCounter=e.rows_counter===!0?!0:!1,this.statusBar=e.status_bar===!0?!0:!1,this.loader=e.loader===!0?!0:!1,this.displayBtn=e.btn===!0?!0:!1,this.btnText=e.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=e.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=e.btn_reset===!0?!0:!1,this.btnResetCssClass=e.btn_reset_css_class||"reset",this.onBeforeReset=types.isFn(e.on_before_reset)?e.on_before_reset:null,this.onAfterReset=types.isFn(e.on_after_reset)?e.on_after_reset:null,this.paging=e.paging===!0?!0:!1,this.hasResultsPerPage=e.results_per_page===!0?!0:!1,this.btnPageCssClass=e.paging_btn_css_class||"pgInp",this.pagingSlc=null,this.resultsPerPage=null,this.resultsPerPageSlc=null,this.isPagingRemoved=!1,this.nbVisibleRows=0,this.nbHiddenRows=0,this.startPagingRow=0,this.nbPages=0,this.currentPageNb=1,this.sort=e.sort===!0?!0:!1,this.isSortEnabled=!1,this.sorted=!1,this.sortConfig=e.sort_config||{},this.sortConfig.name=void 0!==this.sortConfig.name?e.sort_config.name:"sortabletable",this.sortConfig.src=void 0!==this.sortConfig.src?e.sort_config.src:this.basePath+"sortabletable.js",this.sortConfig.adapterSrc=void 0!==this.sortConfig.adapter_src?e.sort_config.adapter_src:this.basePath+"tfAdapter.sortabletable.js",this.sortConfig.initialize=void 0!==this.sortConfig.initialize?e.sort_config.initialize:function(a){a.SetSortTable&&a.SetSortTable()},this.sortConfig.sortTypes=types.isArray(this.sortConfig.sort_types)?e.sort_config.sort_types:[],this.sortConfig.sortCol=void 0!==this.sortConfig.sort_col?e.sort_config.sort_col:null,this.sortConfig.asyncSort=this.sortConfig.async_sort===!0?!0:!1,this.sortConfig.triggerIds=types.isArray(this.sortConfig.sort_trigger_ids)?e.sort_config.sort_trigger_ids:[],this.selectable=e.selectable===!0?!0:!1,this.editable=e.editable===!0?!0:!1,this.ezEditTableConfig=e.ezEditTable_config||{},this.ezEditTableConfig.name=void 0!==this.ezEditTableConfig.name?e.ezEditTable_config.name:"ezedittable",this.ezEditTableConfig.src=void 0!==this.ezEditTableConfig.src?e.ezEditTable_config.src:this.basePath+"ezEditTable/ezEditTable.js",this.ezEditTableConfig.loadStylesheet=this.ezEditTableConfig.loadStylesheet===!0?!0:!1,this.ezEditTableConfig.stylesheet=this.ezEditTableConfig.stylesheet||this.basePath+"ezEditTable/ezEditTable.css",this.ezEditTableConfig.stylesheetName=void 0!==this.ezEditTableConfig.stylesheetName?e.ezEditTable_config.stylesheetName:"ezEditTableCss",this.ezEditTableConfig.err='Failed to instantiate EditTable object.\n"ezEditTable" module may not be available.',this.onKeyUp=e.on_keyup===!0?!0:!1,this.onKeyUpDelay=isNaN(e.on_keyup_delay)?900:e.on_keyup_delay,this.isUserTyping=null,this.onKeyUpTimer=void 0,this.highlightKeywords=e.highlight_keywords===!0?!0:!1,this.highlightCssClass=e.highlight_css_class||"keyword",this.highlightedNodes=[],this.defaultDateType=e.default_date_type||"DMY",this.thousandsSeparator=e.thousands_separator||",",this.decimalSeparator=e.decimal_separator||".",this.hasColNbFormat=e.col_number_format===!0?!0:!1,this.colNbFormat=types.isArray(this.hasColNbFormat)?e.col_number_format:null,this.hasColDateType=e.col_date_type===!0?!0:!1,this.colDateType=types.isArray(this.hasColDateType)?e.col_date_type:null,this.msgFilter=e.msg_filter||"Filtering data...",this.msgPopulate=e.msg_populate||"Populating filter...",this.msgPopulateCheckList=e.msg_populate_checklist||"Populating list...",this.msgChangePage=e.msg_change_page||"Collecting paging data...",this.msgClear=e.msg_clear||"Clearing filters...",this.msgChangeResults=e.msg_change_results||"Changing results per page...",this.msgResetValues=e.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=e.msg_reset_page||"Re-setting page...",this.msgResetPageLength=e.msg_reset_page_length||"Re-setting page length...",this.msgSort=e.msg_sort||"Sorting data...",this.msgLoadExtensions=e.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=e.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxContentDiv="cont_",this.prfxCheckListDiv="chkdiv_",this.prfxSlcPages="slcPages_",this.prfxSlcResults="slcResults_",this.prfxSlcResultsTxt="slcResultsTxt_",this.prfxBtnNextSpan="btnNextSpan_",this.prfxBtnPrevSpan="btnPrevSpan_",this.prfxBtnLastSpan="btnLastSpan_",this.prfxBtnFirstSpan="btnFirstSpan_",this.prfxBtnNext="btnNext_",this.prfxBtnPrev="btnPrev_",this.prfxBtnLast="btnLast_",this.prfxBtnFirst="btnFirst_",this.prfxPgSpan="pgspan_",this.prfxPgBeforeSpan="pgbeforespan_",this.prfxPgAfterSpan="pgafterspan_",this.prfxCounter="counter_",this.prfxTotRows="totrows_span_",this.prfxTotRowsTxt="totRowsTextSpan_",this.prfxResetSpan="resetspan_",this.prfxLoader="load_",this.prfxStatus="status_",this.prfxStatusSpan="statusSpan_",this.prfxStatusTxt="statusText_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.prfxMainTblCont="gridCont_",this.prfxTblCont="tblCont_",this.prfxHeadTblCont="tblHeadCont_",this.prfxHeadTbl="tblHead_",this.prfxGridFltTd="_td_",this.prfxGridTh="tblHeadTh_",this.prfxHelpSpan="helpSpan_",this.prfxHelpDiv="helpDiv_",this.prfxPopUpSpan="popUpSpan_",this.prfxPopUpDiv="popUpDiv_",this.hasStoredValues=!1,this.rememberGridValues=e.remember_grid_values===!0?!0:!1,this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&e.remember_page_number?!0:!1,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&e.remember_page_length?!0:!1,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.cookieDuration=isNaN(e.set_cookie_duration)?1e5:parseInt(e.set_cookie_duration,10),this.hasExtensions=e.extensions===!0?!0:!1,this.extensions=this.hasExtensions?e.extensions:null,this.enableDefaultTheme=e.enable_default_theme===!0?!0:!1,this.hasThemes=e.enable_default_theme||e.themes&&types.isObj(e.themes)?!0:!1,this.themes=this.hasThemes?e.themes:null,this.themesPath=e.themes_path||this.basePath+"TF_Themes/";var j=this;this.Evt={name:{filter:"Filter",populateselect:"Populate",populatechecklist:"PopulateCheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",sort:"Sort",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},getKeyCode:function(a){return a.charCode?a.charCode:a.keyCode?a.keyCode:a.which?a.which:0},_DetectKey:function(a){if(j.enterKey){var b=a||global.event;if(b){var c=j.Evt.getKeyCode(b);13===c?(j._Filter(),evt.cancel(b),evt.stop(b)):(j.isUserTyping=!0,global.clearInterval(j.onKeyUpTimer),j.onKeyUpTimer=void 0)}}},_OnKeyUp:function(a){function b(){global.clearInterval(j.onKeyUpTimer),j.onKeyUpTimer=void 0,j.isUserTyping||(j.Filter(),j.isUserTyping=null)}if(j.onKeyUp){var c=a||global.event,d=j.Evt.getKeyCode(c);j.isUserTyping=!1,13!==d&&9!==d&&27!==d&&38!==d&&40!==d?void 0===j.onKeyUpTimer&&(j.onKeyUpTimer=global.setInterval(b,j.onKeyUpDelay)):(global.clearInterval(j.onKeyUpTimer),j.onKeyUpTimer=void 0)}},_OnKeyDown:function(){j.onKeyUp&&(j.isUserTyping=!0)},_OnInpBlur:function(){j.onKeyUp&&(j.isUserTyping=!1,global.clearInterval(j.onKeyUpTimer)),""===this.value&&""!==j.inpWatermark&&(this.value=j.isInpWatermarkArray?j.inpWatermark[this.getAttribute("ct")]:j.inpWatermark,dom.addClass(this,j.inpWatermarkCssClass)),j.ezEditTable&&(j.editable&&j.ezEditTable.Editable.Set(),j.selectable&&j.ezEditTable.Selection.Set())},_OnInpFocus:function(a){var b=a||global.event;if(j.activeFilterId=this.getAttribute("id"),j.activeFlt=TF.id(j.activeFilterId),j.isInpWatermarkArray){var c=j.inpWatermark[this.getAttribute("ct")];this.value===c&&""!==c&&(this.value="",dom.removeClass(this,j.inpWatermarkCssClass))}else this.value===j.inpWatermark&&""!==j.inpWatermark&&(this.value="",dom.removeClass(this,j.inpWatermarkCssClass));j.popUpFilters&&(evt.cancel(b),evt.stop(b)),j.ezEditTable&&(j.editable&&j.ezEditTable.Editable.Remove(),j.selectable&&j.ezEditTable.Selection.Remove())},_OnSlcFocus:function(a){var b=a||global.event;if(j.activeFilterId=this.getAttribute("id"),j.activeFlt=TF.id(j.activeFilterId),j.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var c=this.getAttribute("ct");j.PopulateSelect(c),TF.isIE||this.setAttribute("filled","1")}j.popUpFilters&&(evt.cancel(b),evt.stop(b))},_OnSlcChange:function(a){var b=j.activeFlt.getAttribute("colIndex");if(!j.activeFlt||!b||j["col"+b]!==j.fltTypeCheckList||j.Evt._OnSlcChange.caller){var c=a||global.event;j.popUpFilters&&evt.stop(c),j.onSlcChange&&j.Filter()}},_OnSlcBlur:function(){},_OnCheckListChange:function(a){j.Evt._OnCheckListChange.caller&&j.Evt._OnSlcChange(a)},_OnCheckListClick:function(){if(j.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var a=this.getAttribute("ct");j.PopulateCheckList(a),j.checkListDiv[a].onclick=null,j.checkListDiv[a].title=""}},_OnCheckListFocus:function(){j.activeFilterId=this.firstChild.getAttribute("id"),j.activeFlt=TF.id(j.activeFilterId)},_OnCheckListBlur:function(){},_OnBtnClick:function(){j.Filter()},_OnSlcPagesChangeEvt:null,_EnableSlc:function(){this.firstChild.disabled=!1,this.firstChild.focus(),this.onclick=null},_Clear:function(){j.ClearFilters()},_OnHelpBtnClick:function(){j._ToggleHelp()},_Paging:{nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null}}}}function numSortAsc(a,b){return a-b}function numSortDesc(a,b){return b-a}function ignoreCaseSort(a,b){var c=str.lower(a),d=str.lower(b);return d>c?-1:c>d?1:0}function removeNbFormat(a,b){if(a){b||(b="us");var c=a;return c="us"===str.lower(b)?+c.replace(/[^\d\.-]/g,""):+c.replace(/[^\d\,-]/g,"").replace(",",".")}}function isImported(a,b){for(var c=!1,d=b?b:"script",e="script"==d?"src":"href",f=TF.tag(doc,d),g=0;g0?f[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popUpFilters&&this.headersRow++,this.popUpFilters&&this.headersRow++,this.fixedHeaders&&this.SetFixedHeaders(),e.className=this.fltsRowCssClass,!this.isExternalFlt||this.gridLayout&&!this.popUpFilters||(e.style.display="none")}this.nbFilterableRows=this.GetRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var g=0;c>g;g++){var h=dom.create(this.fltCellTag),i=this["col"+g],j=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[g]:null;if(this.singleSearchFlt&&(h.colSpan=this.nbCells),this.gridLayout||e.appendChild(h),a=g==c-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.popUpFilters&&this.SetPopupFilter(g),void 0===i&&(i=void 0===b["col_"+g]?this.fltTypeInp:str.lower(b["col_"+g])),this.singleSearchFlt&&(i=this.fltTypeInp,a=this.singleFltCssClass),i===this.fltTypeSlc||i===this.fltTypeMulti){var k=dom.create(this.fltTypeSlc,["id",this.prfxFlt+g+"_"+this.id],["ct",g],["filled","0"]);if(i===this.fltTypeMulti&&(k.multiple=this.fltTypeMulti,k.title=this.multipleSlcTooltip),k.className=str.lower(i)===this.fltTypeSlc?a:this.fltMultiCssClass,j?(TF.id(j).appendChild(k),this.externalFltEls.push(k)):h.appendChild(k),this.fltIds.push(this.prfxFlt+g+"_"+this.id),this.fillSlcOnDemand||this._PopulateSelect(g),k.onkeypress=this.Evt._DetectKey,k.onchange=this.Evt._OnSlcChange,k.onfocus=this.Evt._OnSlcFocus,k.onblur=this.Evt._OnSlcBlur,this.fillSlcOnDemand){var l=dom.createOpt(this.displayAllText,"");k.appendChild(l)}this.fillSlcOnDemand&&TF.isIE&&(k.disabled=!0,k.title=this.activateSlcTooltip,k.parentNode.onclick=this.Evt._EnableSlc,i===this.fltTypeMulti&&this.__deferMultipleSelection(k,0))}else if(i===this.fltTypeCheckList){var m=dom.create("div",["id",this.prfxCheckListDiv+g+"_"+this.id],["ct",g],["filled","0"]);m.className=this.checkListDivCssClass,j?(TF.id(j).appendChild(m),this.externalFltEls.push(m)):h.appendChild(m),this.checkListDiv[g]=m,this.fltIds.push(this.prfxFlt+g+"_"+this.id),this.fillSlcOnDemand||this._PopulateCheckList(g),m.onclick=this.Evt._OnCheckListFocus,this.fillSlcOnDemand&&(m.onclick=this.Evt._OnCheckListClick,m.appendChild(dom.text(this.activateCheckListTxt)))}else{var n=i===this.fltTypeInp?"text":"hidden",o=dom.create(this.fltTypeInp,["id",this.prfxFlt+g+"_"+this.id],["type",n],["ct",g]);if("hidden"!=n&&(o.value=this.isInpWatermarkArray?this.inpWatermark[g]:this.inpWatermark),o.className=a,""!==this.inpWatermark&&dom.addClass(o,this.inpWatermarkCssClass),o.onfocus=this.Evt._OnInpFocus,j?(TF.id(j).appendChild(o),this.externalFltEls.push(o)):h.appendChild(o),this.fltIds.push(this.prfxFlt+g+"_"+this.id),o.onkeypress=this.Evt._DetectKey,o.onkeydown=this.Evt._OnKeyDown,o.onkeyup=this.Evt._OnKeyUp,o.onblur=this.Evt._OnInpBlur,this.rememberGridValues){var p=cookie.read(this.fltsValuesCookie),q=new RegExp(this.separator,"g"),r=p.split(q);" "!=r[g]&&this.SetFilterValue(g,r[g],!1)}}if(g==c-1&&this.displayBtn){var s=dom.create(this.fltTypeInp,["id",this.prfxValButton+g+"_"+this.id],["type","button"],["value",this.btnText]);s.className=this.btnCssClass,j?TF.id(j).appendChild(s):h.appendChild(s),s.onclick=this.Evt._OnBtnClick}}}else this.__resetGrid();else this.refRow=this.refRow-1,this.gridLayout&&(this.refRow=0),this.nbFilterableRows=this.GetRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow;this.rowsCounter&&this.SetRowsCounter(),this.statusBar&&this.SetStatusBar(),this.fixedHeaders&&!this.isFirstLoad&&this.SetFixedHeaders(),this.paging&&this.SetPaging(),this.hasResultsPerPage&&this.paging&&this.SetResultsPerPage(),this.btnReset&&this.SetResetBtn(),this.helpInstructions&&this.SetHelpInstructions(),this.hasColWidth&&!this.gridLayout&&this.SetColWidths(),this.alternateBgs&&this.isStartBgAlternate&&this.SetAlternateRows(),this.hasColOperation&&this.fltGrid&&(this.colOperation=b.col_operation,this.SetColOperation()),(this.sort||this.gridLayout)&&this.SetSort(),(this.selectable||this.editable)&&this.SetEditable(),this.isFirstLoad=!1,this.hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.ResetValues(),this.gridLayout||dom.addClass(this.tbl,this.prfxTf),this.loader&&this.loaderComponent.show("none"),this.hasExtensions&&this.LoadExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this)}},EvtManager:function(a,b){function c(){if(a){switch(a){case d.Evt.name.filter:d.isModFilterFn?d.modFilterFn.call(null,d):d._Filter();break;case d.Evt.name.populateselect:d.refreshFilters?d._PopulateSelect(e,!0):d._PopulateSelect(e,!1,f,g);break;case d.Evt.name.populatechecklist:d._PopulateCheckList(e,f,g);break;case d.Evt.name.changepage:d._ChangePage(h);break;case d.Evt.name.clear:d._ClearFilters(),d._Filter();break;case d.Evt.name.changeresultsperpage:d._ChangeResultsPerPage();break;case d.Evt.name.resetvalues:d._ResetValues(),d._Filter();break;case d.Evt.name.resetpage:d._ResetPage(d.pgNbCookie);break;case d.Evt.name.resetpagelength:d._ResetPageLength(d.pgLenCookie);break;case d.Evt.name.sort:break;case d.Evt.name.loadextensions:d._LoadExtensions();break;case d.Evt.name.loadthemes:d._LoadThemes();break;default:d["_"+a].call(null,d,b)}(d.status||d.statusBar)&&d.StatusMsg(""),d.loader&&d.loaderComponent.show("none")}}var d=this,e=b&&void 0!==b.slcIndex?b.slcIndex:null,f=b&&void 0!==b.slcExternal?b.slcExternal:!1,g=b&&void 0!==b.slcId?b.slcId:null,h=b&&void 0!==b.pgIndex?b.pgIndex:null;if(this.loader||this.status||this.statusBar){try{this.loaderComponent.show(""),this.StatusMsg(d["msg"+a])}catch(i){}global.setTimeout(c,this.execDelay)}else c()},ImportModule:function(a){a.path&&a.name&&this.IncludeFile(a.name,a.path,a.init)},LoadExtensions:function(){if(!this.Ext){var a=this;this.Ext={list:{},add:function(b,c,d,e){var f=d.split("/")[d.split("/").length-1],g=new RegExp(f),h=d.replace(g,"");a.Ext.list[b]={name:b,description:c,file:f,path:h,callback:e}}}}this.EvtManager(this.Evt.name.loadextensions)},_LoadExtensions:function(){if(this.hasExtensions&&types.isArray(this.extensions.name)&&types.isArray(this.extensions.src))for(var a=this.extensions,b=0;b',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},RemoveGrid:function(){if(this.fltGrid&&this.hasGrid){var a=this.tbl.rows;this.paging&&this.RemovePaging(),this.statusBar&&this.RemoveStatusBar(),this.rowsCounter&&this.RemoveRowsCounter(),this.btnReset&&this.RemoveResetBtn(),(this.helpInstructions||!this.helpInstructions)&&this.RemoveHelpInstructions(),this.paging&&this.RemoveResultsPerPage(),this.isExternalFlt&&!this.popUpFilters&&this.RemoveExternalFlts(),this.fixedHeaders&&this.RemoveFixedHeaders(),this.infDiv&&this.RemoveTopDiv(),this.highlightKeywords&&this.UnhighlightAll(),this.sort&&this.RemoveSort(),this.loader&&this.loaderComponent.remove(),this.popUpFilters&&this.RemovePopupFilters(),this.markActiveColumns&&this.ClearActiveColumns(),(this.editable||this.selectable)&&this.RemoveEditable();for(var b=this.refRow;b0&&!c.startRow?void 0:c.startRow||a.refRow,c.scroll_into_view=c.scroll_into_view===!1?!1:!0,c.base_path=c.base_path||a.basePath+"ezEditTable/",c.editable=a.editable=a.fObj.editable,c.selection=a.selectable=a.fObj.selectable,a.selectable&&(c.default_selection=c.default_selection||"row"),c.active_cell_css=c.active_cell_css||"ezETSelectedCell",a._lastValidRowIndex=0,a._lastRowIndex=0,a.selectable){var e=function(b,c,d){if(a.validRowsIndex){var e,f=a.validRowsIndex,g=f.length,h="row"!==b.defaultSelection?c.parentNode:c,i="TD"===c.nodeName?c:null,j=void 0!==d?b.Event.GetKey(d):0,k=array.has(f,h.rowIndex),l=34===j||33===j?a.pagingLength||b.nbRowsPerPage:1;if(k)34!==j&&33!==j?(a._lastValidRowIndex=array.indexByValue(f,h.rowIndex),a._lastRowIndex=h.rowIndex):(e=34===j?a._lastValidRowIndex+l<=g-1?f[a._lastValidRowIndex+l]:[g-1]:a._lastValidRowIndex-l<=f[0]?f[0]:f[a._lastValidRowIndex-l],a._lastRowIndex=e,a._lastValidRowIndex=array.indexByValue(f,e),o(e));else{if(h.rowIndex>a._lastRowIndex)if(h.rowIndex>=f[g-1])e=f[g-1];else{var m=a._lastValidRowIndex+l;e=m>g-1?f[g-1]:f[m]}else if(h.rowIndex<=f[0])e=f[0];else{var n=f[a._lastValidRowIndex-l];e=n?n:f[0]}a._lastRowIndex=h.rowIndex,o(e)}var o=function(d){if("row"===b.defaultSelection)b.Selection.SelectRowByIndex(d); -else{b.ClearSelections();var e=c.cellIndex,f=a.tbl.rows[d];"both"===b.defaultSelection&&b.Selection.SelectRowByIndex(d),f&&b.Selection.SelectCell(f.cells[e])}if(a.validRowsIndex.length!==a.GetRowsNb()){var g=a.tbl.rows[d];g&&g.scrollIntoView(!1),i&&(i.cellIndex===a.GetCellsNb()-1&&a.gridLayout?a.tblCont.scrollLeft=1e8:0===i.cellIndex&&a.gridLayout?a.tblCont.scrollLeft=0:i.scrollIntoView(!1))}}}},f=function(b,c){var d="row"!==b.defaultSelection?c.parentNode:c;if(a.paging&&a.nbPages>1){b.nbRowsPerPage=a.pagingLength;var e=a.validRowsIndex,f=e.length,g=parseInt(a.startPagingRow,10)+parseInt(a.pagingLength,10),h=d.rowIndex;h===e[f-1]&&a.currentPageNb!=a.nbPages?a.SetPage("last"):h==e[0]&&1!==a.currentPageNb?a.SetPage("first"):h>e[g-1]&&he[0]&&a.SetPage("previous")}};if(a.paging&&(a.onAfterChangePage=function(a){var b=a.ezEditTable,c=b.Selection.GetActiveRow();c&&c.scrollIntoView(!1);var d=b.Selection.GetActiveCell();d&&d.scrollIntoView(!1)}),"row"===c.default_selection){var g=c.on_before_selected_row;c.on_before_selected_row=function(){f(arguments[0],arguments[1],arguments[2]),g&&g.call(null,arguments[0],arguments[1],arguments[2])};var h=c.on_after_selected_row;c.on_after_selected_row=function(){e(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var i=c.on_before_selected_cell;c.on_before_selected_cell=function(){f(arguments[0],arguments[1],arguments[2]),i&&i.call(null,arguments[0],arguments[1],arguments[2])};var j=c.on_after_selected_cell;c.on_after_selected_cell=function(){e(arguments[0],arguments[1],arguments[2]),j&&j.call(null,arguments[0],arguments[1],arguments[2])}}}if(a.editable){var k=c.on_added_dom_row;if(c.on_added_dom_row=function(){a.nbFilterableRows++,a.paging?(a.nbRows++,a.nbVisibleRows++,a.nbFilterableRows++,a.paging=!1,a.RemovePaging(),a.AddPaging(!1)):a.RefreshNbRows(),a.alternateBgs&&a.SetAlternateRows(),k&&k.call(null,arguments[0],arguments[1],arguments[2])},c.actions&&c.actions["delete"]){var l=c.actions["delete"].on_after_submit;c.actions["delete"].on_after_submit=function(){a.nbFilterableRows--,a.paging?(a.nbRows--,a.nbVisibleRows--,a.nbFilterableRows--,a.paging=!1,a.RemovePaging(),a.AddPaging(!1)):a.RefreshNbRows(),a.alternateBgs&&a.SetAlternateRows(),l&&l.call(null,arguments[0],arguments[1])}}}try{a.ezEditTable=new EditTable(a.id,c,b),a.ezEditTable.Init()}catch(m){console.log(c.err)}},SetPaging:function(){if((this.hasGrid||this.isFirstLoad)&&this.paging&&(this.isPagingRemoved||this.isFirstLoad)){var a=this.fObj;this.pagingTgtId=a.paging_target_id||null,this.pagingLength=isNaN(a.paging_length)?10:a.paging_length,this.resultsPerPageTgtId=a.results_per_page_target_id||null,this.pgSlcCssClass=a.paging_slc_css_class||"pgSlc",this.pgInpCssClass=a.paging_inp_css_class||"pgNbInp",this.resultsSlcCssClass=a.results_slc_css_class||"rspg",this.resultsSpanCssClass=a.results_span_css_class||"rspgSpan",this.nbVisibleRows=0,this.nbHiddenRows=0,this.startPagingRow=0,this.nbPages=0,this.btnNextPageText=a.btn_next_page_text||">",this.btnPrevPageText=a.btn_prev_page_text||"<",this.btnLastPageText=a.btn_last_page_text||">|",this.btnFirstPageText=a.btn_first_page_text||"|<",this.btnNextPageHtml=a.btn_next_page_html||(this.enableIcons?'':null),this.btnPrevPageHtml=a.btn_prev_page_html||(this.enableIcons?'':null),this.btnFirstPageHtml=a.btn_first_page_html||(this.enableIcons?'':null),this.btnLastPageHtml=a.btn_last_page_html||(this.enableIcons?'':null),this.pageText=a.page_text||" Page ",this.ofText=a.of_text||" of ",this.nbPgSpanCssClass=a.nb_pages_css_class||"nbpg",this.hasPagingBtns=a.paging_btns===!1?!1:!0,this.pagingBtnEvents=null,this.pageSelectorType=a.page_selector_type||this.fltTypeSlc,this.onBeforeChangePage=types.isFn(a.on_before_change_page)?a.on_before_change_page:null,this.onAfterChangePage=types.isFn(a.on_after_change_page)?a.on_after_change_page:null;var b=this.refRow,c=this.nbRows;if(this.nbPages=Math.ceil((c-b)/this.pagingLength),!this.Evt._Paging.next){var d=this;this.Evt._Paging={slcIndex:function(){return d.pageSelectorType===d.fltTypeSlc?d.pagingSlc.options.selectedIndex:parseInt(d.pagingSlc.value,10)-1},nbOpts:function(){return d.pageSelectorType===d.fltTypeSlc?parseInt(d.pagingSlc.options.length,10)-1:d.nbPages-1},next:function(){d.Evt._Paging.nextEvt&&d.Evt._Paging.nextEvt();var a=d.Evt._Paging.slcIndex()0?d.Evt._Paging.slcIndex()-1:d.Evt._Paging.nbOpts();d.ChangePage(a)},last:function(){d.Evt._Paging.lastEvt&&d.Evt._Paging.lastEvt(),d.ChangePage(d.Evt._Paging.nbOpts())},first:function(){d.Evt._Paging.firstEvt&&d.Evt._Paging.firstEvt(),d.ChangePage(0)},_detectKey:function(a){var b=a||global.event;if(b){var c=d.Evt.getKeyCode(a);13===c&&(d.sorted?(d.Filter(),d.ChangePage(d.Evt._Paging.slcIndex())):d.ChangePage(),this.blur())}},nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null}}this.Evt._OnSlcPagesChange||(this.Evt._OnSlcPagesChange=function(){d.Evt._Paging._OnSlcPagesChangeEvt&&d.Evt._Paging._OnSlcPagesChangeEvt(),d.ChangePage(),this.blur(),this.parentNode&&TF.isIE&&this.parentNode.focus()});var e;this.pageSelectorType===this.fltTypeSlc&&(e=dom.create(this.fltTypeSlc,["id",this.prfxSlcPages+this.id]),e.className=this.pgSlcCssClass,e.onchange=this.Evt._OnSlcPagesChange),this.pageSelectorType===this.fltTypeInp&&(e=dom.create(this.fltTypeInp,["id",this.prfxSlcPages+this.id],["value",this.currentPageNb]),e.className=this.pgInpCssClass,e.onkeypress=this.Evt._Paging._detectKey);var f=dom.create("span",["id",this.prfxBtnNextSpan+this.id]),g=dom.create("span",["id",this.prfxBtnPrevSpan+this.id]),h=dom.create("span",["id",this.prfxBtnLastSpan+this.id]),i=dom.create("span",["id",this.prfxBtnFirstSpan+this.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)f.innerHTML=this.btnNextPageHtml,f.onclick=this.Evt._Paging.next;else{var j=dom.create(this.fltTypeInp,["id",this.prfxBtnNext+this.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);j.className=this.btnPageCssClass,j.onclick=this.Evt._Paging.next,f.appendChild(j)}if(this.btnPrevPageHtml)g.innerHTML=this.btnPrevPageHtml,g.onclick=this.Evt._Paging.prev;else{var k=dom.create(this.fltTypeInp,["id",this.prfxBtnPrev+this.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);k.className=this.btnPageCssClass,k.onclick=this.Evt._Paging.prev,g.appendChild(k)}if(this.btnLastPageHtml)h.innerHTML=this.btnLastPageHtml,h.onclick=this.Evt._Paging.last;else{var l=dom.create(this.fltTypeInp,["id",this.prfxBtnLast+this.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);l.className=this.btnPageCssClass,l.onclick=this.Evt._Paging.last,h.appendChild(l)}if(this.btnFirstPageHtml)i.innerHTML=this.btnFirstPageHtml,i.onclick=this.Evt._Paging.first;else{var m=dom.create(this.fltTypeInp,["id",this.prfxBtnFirst+this.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);m.className=this.btnPageCssClass,m.onclick=this.Evt._Paging.first,i.appendChild(m)}}this.pagingTgtId||this.SetTopDiv();var n=this.pagingTgtId?TF.id(this.pagingTgtId):this.mDiv;""!==n.innerHTML&&(n.innerHTML=""),n.appendChild(i),n.appendChild(g);var o=dom.create("span",["id",this.prfxPgBeforeSpan+this.id]);o.appendChild(dom.text(this.pageText)),o.className=this.nbPgSpanCssClass,n.appendChild(o),n.appendChild(e);var p=dom.create("span",["id",this.prfxPgAfterSpan+this.id]);p.appendChild(dom.text(this.ofText)),p.className=this.nbPgSpanCssClass,n.appendChild(p);var q=dom.create("span",["id",this.prfxPgSpan+this.id]);q.className=this.nbPgSpanCssClass,q.appendChild(dom.text(" "+this.nbPages+" ")),n.appendChild(q),n.appendChild(f),n.appendChild(h),this.pagingSlc=TF.id(this.prfxSlcPages+this.id),(!this.rememberGridValues||this.isPagingRemoved)&&this.SetPagingInfo(),this.fltGrid||(this.ValidateAllRows(),this.SetPagingInfo(this.validRowsIndex)),this.pagingBtnEvents=this.Evt._Paging,this.isPagingRemoved=!1}},RemovePaging:function(){if(this.hasGrid&&this.pagingSlc){var a,b,c,d,e,f,g;a=TF.id(this.prfxBtnNextSpan+this.id),b=TF.id(this.prfxBtnPrevSpan+this.id),c=TF.id(this.prfxBtnLastSpan+this.id),d=TF.id(this.prfxBtnFirstSpan+this.id),e=TF.id(this.prfxPgBeforeSpan+this.id),f=TF.id(this.prfxPgAfterSpan+this.id),g=TF.id(this.prfxPgSpan+this.id),this.pagingSlc.parentNode.removeChild(this.pagingSlc),a&&a.parentNode.removeChild(a),b&&b.parentNode.removeChild(b),c&&c.parentNode.removeChild(c),d&&d.parentNode.removeChild(d),e&&e.parentNode.removeChild(e),f&&f.parentNode.removeChild(f),g&&g.parentNode.removeChild(g),this.pagingBtnEvents=null,this.pagingSlc=null,this.isPagingRemoved=!0}},SetPagingInfo:function(a){var b=this.tbl.rows,c=this.pagingTgtId?TF.id(this.pagingTgtId):this.mDiv,d=TF.id(this.prfxPgSpan+this.id);if(a&&a.length>0)this.validRowsIndex=a;else{this.validRowsIndex=[];for(var e=this.refRow;e0)if(c.style.visibility="visible",this.pageSelectorType===this.fltTypeSlc)for(var h=0;h=this.startPagingRow&&c>d?("true"!==e.getAttribute("validRow")&&e.getAttribute("validRow")||(e.style.display=""),this.alternateBgs&&this.SetRowBg(this.validRowsIndex[d],d)):(e.style.display="none",this.alternateBgs&&this.RemoveRowBg(this.validRowsIndex[d]))}this.nbVisibleRows=this.validRowsIndex.length,this.isStartBgAlternate=!1,this.ApplyGridProps()},SetPage:function(a){if(this.hasGrid&&this.paging){var b=this.pagingBtnEvents,c=typeof a;if("string"===c)switch(str.lower(a)){case"next":b.next();break;case"previous":b.prev();break;case"last":b.last();break;case"first":b.first();break;default:b.next()}"number"===c&&this.ChangePage(a-1)}},SetResultsPerPage:function(){if((this.hasGrid||this.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){if(!this.Evt._OnSlcResultsChange){var a=this;this.Evt._OnSlcResultsChange=function(){a.ChangeResultsPerPage(),this.blur(),this.parentNode&&TF.isIE&&this.parentNode.focus()}}var b=dom.create(this.fltTypeSlc,["id",this.prfxSlcResults+this.id]);b.className=this.resultsSlcCssClass;var c=this.resultsPerPage[0],d=this.resultsPerPage[1],e=dom.create("span",["id",this.prfxSlcResultsTxt+this.id]);e.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||this.SetTopDiv();var f=this.resultsPerPageTgtId?TF.id(this.resultsPerPageTgtId):this.rDiv;e.appendChild(dom.text(c)),f.appendChild(e),f.appendChild(b),this.resultsPerPageSlc=TF.id(this.prfxSlcResults+this.id);for(var g=0;g<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
These operators are described here:
http://tablefilter.free.fr/#operators
',this.helpInstrHtml=a.help_instructions_html||null,this.helpInstrBtnText=a.help_instructions_btn_text||"?",this.helpInstrBtnHtml=a.help_instructions_btn_html||null,this.helpInstrBtnCssClass=a.help_instructions_btn_css_class||"helpBtn",this.helpInstrContCssClass=a.help_instructions_container_css_class||"helpCont",this.helpInstrBtnEl=null,this.helpInstrContEl=null,this.helpInstrDefaultHtml='

HTML Table Filter Generator v. '+this.version+'

http://tablefilter.free.fr
©2009-'+this.year+' Max Guglielmi.
";var b=dom.create("span",["id",this.prfxHelpSpan+this.id]),c=dom.create("div",["id",this.prfxHelpDiv+this.id]);this.helpInstrTgtId||this.SetTopDiv();var d=this.helpInstrTgtId?TF.id(this.helpInstrTgtId):this.rDiv;d.appendChild(b);var e=this.helpInstrContTgtId?TF.id(this.helpInstrContTgtId):b;if(this.helpInstrBtnHtml){b.innerHTML=this.helpInstrBtnHtml;var f=b.firstChild;f.onclick=this.Evt._OnHelpBtnClick,e.appendChild(c)}else{e.appendChild(c);var g=dom.create("a",["href","javascript:void(0);"]);g.className=this.helpInstrBtnCssClass,g.appendChild(dom.text(this.helpInstrBtnText)),b.appendChild(g),g.onclick=this.Evt._OnHelpBtnClick}this.helpInstrHtml?(this.helpInstrContTgtId&&e.appendChild(c),c.innerHTML=this.helpInstrHtml,this.helpInstrContTgtId||(c.className=this.helpInstrContCssClass,c.ondblclick=this.Evt._OnHelpBtnClick)):(c.innerHTML=this.helpInstrText,c.className=this.helpInstrContCssClass,c.ondblclick=this.Evt._OnHelpBtnClick),c.innerHTML+=this.helpInstrDefaultHtml,this.helpInstrContEl=c,this.helpInstrBtnEl=b}},RemoveHelpInstructions:function(){this.helpInstrBtnEl&&(this.helpInstrBtnEl.parentNode.removeChild(this.helpInstrBtnEl),this.helpInstrBtnEl=null,this.helpInstrContEl&&(this.helpInstrContEl.parentNode.removeChild(this.helpInstrContEl),this.helpInstrContEl=null))},_ToggleHelp:function(){if(this.helpInstrContEl){var a=this.helpInstrContEl.style.display;if(""===a||"none"===a){this.helpInstrContEl.style.display="block";var b=dom.position(this.helpInstrBtnEl).left;this.helpInstrContTgtId||(this.helpInstrContEl.style.left=b-this.helpInstrContEl.clientWidth+25+"px")}else this.helpInstrContEl.style.display="none"}},ChangePage:function(a){this.EvtManager(this.Evt.name.changepage,{pgIndex:a})},_ChangePage:function(a){this.paging&&(a||(a=this.pageSelectorType===this.fltTypeSlc?this.pagingSlc.options.selectedIndex:this.pagingSlc.value-1),a>=0&&a<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,a),this.currentPageNb=parseInt(a,10)+1,this.pageSelectorType===this.fltTypeSlc?this.pagingSlc.options[a].selected=!0:this.pagingSlc.value=this.currentPageNb,this.rememberPageNb&&this.RememberPageNb(this.pgNbCookie),this.startPagingRow=this.pageSelectorType===this.fltTypeSlc?this.pagingSlc.value:a*this.pagingLength,this.GroupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,a)))},ChangeResultsPerPage:function(){this.EvtManager(this.Evt.name.changeresultsperpage)},_ChangeResultsPerPage:function(){if(this.paging){var a=this.resultsPerPageSlc,b=this.pageSelectorType==this.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(a.options[a.selectedIndex].value,10),this.startPagingRow=this.pagingLength*b,!isNaN(this.pagingLength)){if(this.startPagingRow>=this.nbFilterableRows&&(this.startPagingRow=this.nbFilterableRows-this.pagingLength),this.SetPagingInfo(),this.pageSelectorType===this.fltTypeSlc){var c=this.pagingSlc.options.length-1<=b?this.pagingSlc.options.length-1:b;this.pagingSlc.options[c].selected=!0}this.rememberPageLen&&this.RememberPageLength(this.pgLenCookie)}}},ResetPage:function(){this.EvtManager(this.Evt.name.resetpage)},_ResetPage:function(a){var b=cookie.read(a);""!==b&&this.ChangePage(b-1)},ResetPageLength:function(){this.EvtManager(this.Evt.name.resetpagelength)},_ResetPageLength:function(a){if(this.paging){var b=cookie.read(a);""!==b&&(this.resultsPerPageSlc.options[b].selected=!0,this.ChangeResultsPerPage())}},AddPaging:function(a){this.hasGrid&&!this.paging&&(this.paging=!0,this.isPagingRemoved=!0,this.SetPaging(),this.ResetValues(),a&&this.Filter())},PopulateSelect:function(a,b,c){this.EvtManager(this.Evt.name.populateselect,{slcIndex:a,slcExternal:b,slcId:c})},_PopulateSelect:function(a,b,c,d){function e(){if("innerhtml"===m)o+='";else{var a=dom.createOpt(j.enableSlcResetFilter?j.displayAllText:"","");if(j.enableSlcResetFilter||(a.style.display="none"),i.appendChild(a),j.enableEmptyOption){var b=dom.createOpt(j.emptyText,j.emOperator);i.appendChild(b)}if(j.enableNonEmptyOption){var c=dom.createOpt(j.nonEmptyText,j.nmOperator);i.appendChild(c)}}}function f(){var c=i.value;i.innerHTML="",e();for(var d=0;d"+g+""}else{var l;l=j.fillSlcOnDemand&&c==n[d]&&j["col"+a]===j.fltTypeSlc?dom.createOpt(g,f,!0):j["col"+a]!=j.fltTypeMulti?dom.createOpt(g,f," "!==r[a]&&f==r[a]?!0:!1):dom.createOpt(g,f,array.has(s,str.matchCase(n[d],j.matchCase),j.matchCase)||-1!==s.toString().indexOf(f)?!0:!1),h&&(l.disabled=!0),i.appendChild(l)}}"innerhtml"===m&&(i.innerHTML+=o),i.setAttribute("filled","1")}c=void 0===c?!1:c;var g=this.fltIds[a];if((TF.id(g)||c)&&(TF.id(d)||!c)){var h,i=TF.id(c?d:g),j=this,k=this.tbl.rows,l=this.matchCase,m=str.lower(this.slcFillingMethod),n=[],o="",p=this.hasCustomSlcOptions&&array.has(this.customSlcOptions.cols,a),q=[];b&&this.activeFilterId&&(h=this.activeFilterId.split("_")[0],h=h.split(this.prfxFlt)[1]);var r=[],s=[];this.rememberGridValues&&(r=cookie.valueToArray(this.fltsValuesCookie,this.separator),r&&!str.isEmpty(r.toString())&&(p?s.push(r[a]):s=r[a].split(" "+j.orOperator+" ")));var t=null,u=null;b&&this.disableExcludedOptions&&(t=[],u=[]);for(var v=this.refRow;vy;y++)if(a===y&&(!b||b&&this.disableExcludedOptions)||a==y&&b&&(""===k[v].style.display&&!this.paging||this.paging&&(!this.validRowsIndex||this.validRowsIndex&&array.has(this.validRowsIndex,v))&&(void 0===h||h==a||h!=a&&array.has(this.validRowsIndex,v)))){var z=this.GetCellData(y,w[y]),A=str.matchCase(z,l);if(array.has(n,A,l)||n.push(z),b&&this.disableExcludedOptions){var B=u[y];B||(B=this.GetFilteredDataCol(y)),array.has(B,A,l)||array.has(t,A,l)||this.isFirstLoad||t.push(z)}}}if(p){var C=this.__getCustomValues(a);n=C[0],q=C[1]}if(this.sortSlc&&!p&&(l?(n.sort(),t&&t.sort()):(n.sort(ignoreCaseSort),t&&t.sort(ignoreCaseSort))),this.sortNumAsc&&array.has(this.sortNumAsc,a))try{n.sort(numSortAsc),t&&t.sort(numSortAsc),p&&q.sort(numSortAsc)}catch(D){n.sort(),t&&t.sort(),p&&q.sort()}if(this.sortNumDesc&&array.has(this.sortNumDesc,a))try{n.sort(numSortDesc),t&&t.sort(numSortDesc),p&&q.sort(numSortDesc)}catch(D){n.sort(),t&&t.sort(),p&&q.sort()}f()}},__deferMultipleSelection:function(a,b,c){if("select"===str.lower(a.nodeName)){var d=void 0===c?!1:c,e=this;global.setTimeout(function(){a.options[0].selected=!1,a.options[b].selected=""===a.options[b].value?!1:!0,d&&e.Filter()},.1)}},__getCustomValues:function(a){if(a){var b=this.hasCustomSlcOptions&&array.has(this.customSlcOptions.cols,a);if(b){for(var c=[],d=[],e=array.indexByValue(this.customSlcOptions.cols,a),f=this.customSlcOptions.values[e],g=this.customSlcOptions.texts[e],h=this.customSlcOptions.sorts[e],i=0;i0&&(j.hasCustomSlcOptions&&array.has(j.customSlcOptions.cols,a)?g.push(i):g=i.split(" "+j.orOperator+" "));for(var k=0;kt;t++)if(a===t&&(!this.refreshFilters||this.refreshFilters&&this.disableExcludedOptions)||a===t&&this.refreshFilters&&(""===k[q].style.display&&!this.paging||this.paging&&(!i||i===a||i!=a&&array.has(this.validRowsIndex,q)))){var u=this.GetCellData(t,r[t]),v=str.matchCase(u,this.matchCase);array.has(l,v,this.matchCase)||l.push(u);var w=p[t];this.refreshFilters&&this.disableExcludedOptions&&(w||(p[t]=this.GetFilteredDataCol(t)),array.has(w,v,this.matchCase)||array.has(o,v,this.matchCase)||this.isFirstLoad||o.push(u))}}if(m){var x=this.__getCustomValues(a);l=x[0],n=x[1]}if(this.sortSlc&&!m&&(this.matchCase?(l.sort(),o&&o.sort()):(l.sort(ignoreCaseSort),o&&o.sort(ignoreCaseSort))),this.sortNumAsc&&array.has(this.sortNumAsc,a))try{l.sort(numSortAsc),o&&o.sort(numSortAsc),m&&n.sort(numSortAsc)}catch(y){l.sort(),o&&o.sort(),m&&n.sort()}if(this.sortNumDesc&&array.has(this.sortNumDesc,a))try{l.sort(numSortDesc),o&&o.sort(numSortDesc),m&&n.sort(numSortDesc)}catch(y){l.sort(),o&&o.sort(),m&&n.sort()}if(e(this.separator),this.fillSlcOnDemand&&(g.innerHTML=""),g.appendChild(h),g.setAttribute("filled","1"),j.rememberGridValues&&TF.isIE){var z=h.getAttribute("indexes");if(z)for(var A=z.split(","),B=0;B':null);var b=dom.create("span",["id",this.prfxResetSpan+this.id]);this.btnResetTgtId||this.SetTopDiv();var c=this.btnResetTgtId?TF.id(this.btnResetTgtId):this.rDiv;if(c.appendChild(b),this.btnResetHtml){b.innerHTML=this.btnResetHtml;var d=b.firstChild;d.onclick=this.Evt._Clear}else{var e=dom.create("a",["href","javascript:void(0);"]);e.className=this.btnResetCssClass,e.appendChild(dom.text(this.btnResetText)),b.appendChild(e),e.onclick=this.Evt._Clear}this.btnResetEl=TF.id(this.prfxResetSpan+this.id).firstChild}},RemoveResetBtn:function(){if(this.hasGrid&&this.btnResetEl){var a=TF.id(this.prfxResetSpan+this.id);a&&a.parentNode.removeChild(a),this.btnResetEl=null}},SetStatusBar:function(){if(this.hasGrid||this.isFirstLoad){var a=this.fObj;this.statusBarTgtId=a.status_bar_target_id||null,this.statusBarDiv=null,this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarText=a.status_bar_text||"",this.statusBarCssClass=a.status_bar_css_class||"status",this.statusBarCloseDelay=250;var b=dom.create("div",["id",this.prfxStatus+this.id]);b.className=this.statusBarCssClass;var c=dom.create("span",["id",this.prfxStatusSpan+this.id]),d=dom.create("span",["id",this.prfxStatusTxt+this.id]);d.appendChild(dom.text(this.statusBarText)),this.onBeforeShowMsg=types.isFn(a.on_before_show_msg)?a.on_before_show_msg:null,this.onAfterShowMsg=types.isFn(a.on_after_show_msg)?a.on_after_show_msg:null,this.statusBarTgtId||this.SetTopDiv();var e=this.statusBarTgtId?TF.id(this.statusBarTgtId):this.lDiv;this.statusBarDiv&&TF.isIE&&(this.statusBarDiv.outerHTML=""),this.statusBarTgtId?(e.appendChild(d),e.appendChild(c)):(b.appendChild(d),b.appendChild(c),e.appendChild(b)),this.statusBarDiv=TF.id(this.prfxStatus+this.id),this.statusBarSpan=TF.id(this.prfxStatusSpan+this.id),this.statusBarSpanText=TF.id(this.prfxStatusTxt+this.id)}},RemoveStatusBar:function(){(this.hasGrid||this.statusBarDiv)&&(this.statusBarDiv.innerHTML="",this.statusBarDiv.parentNode.removeChild(this.statusBarDiv),this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarDiv=null)},StatusMsg:function(a){a||this.StatusMsg(""),this.status&&this.WinStatusMsg(a),this.statusBar&&this.StatusBarMsg(a)},WinStatusMsg:function(a){this.status&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this,a),global.status=a,this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this,a))},StatusBarMsg:function(a){function b(){c.statusBarSpan.innerHTML=a,c.onAfterShowMsg&&c.onAfterShowMsg.call(null,c,a)}if(this.statusBar&&this.statusBarSpan){this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this,a);var c=this,d=""===a?this.statusBarCloseDelay:1;global.setTimeout(b,d)}},SetRowsCounter:function(){if((this.hasGrid||this.isFirstLoad)&&!this.rowsCounterSpan){var a=this.fObj;this.rowsCounterTgtId=a.rows_counter_target_id||null,this.rowsCounterDiv=null,this.rowsCounterSpan=null,this.rowsCounterText=a.rows_counter_text||"Rows: ",this.fromToTextSeparator=a.from_to_text_separator||"-",this.overText=a.over_text||" / ",this.totRowsCssClass=a.tot_rows_css_class||"tot",this.onBeforeRefreshCounter=types.isFn(a.on_before_refresh_counter)?a.on_before_refresh_counter:null,this.onAfterRefreshCounter=types.isFn(a.on_after_refresh_counter)?a.on_after_refresh_counter:null;var b=dom.create("div",["id",this.prfxCounter+this.id]);b.className=this.totRowsCssClass;var c=dom.create("span",["id",this.prfxTotRows+this.id]),d=dom.create("span",["id",this.prfxTotRowsTxt+this.id]);d.appendChild(dom.text(this.rowsCounterText)),this.rowsCounterTgtId||this.SetTopDiv();var e=this.rowsCounterTgtId?TF.id(this.rowsCounterTgtId):this.lDiv;this.rowsCounterDiv&&TF.isIE&&(this.rowsCounterDiv.outerHTML=""),this.rowsCounterTgtId?(e.appendChild(d),e.appendChild(c)):(b.appendChild(d),b.appendChild(c),e.appendChild(b)),this.rowsCounterDiv=TF.id(this.prfxCounter+this.id),this.rowsCounterSpan=TF.id(this.prfxTotRows+this.id),this.RefreshNbRows()}},RemoveRowsCounter:function(){this.hasGrid&&this.rowsCounterSpan&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?TF.isIE?this.rowsCounterDiv.outerHTML="":this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv):TF.id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null)},RefreshNbRows:function(a){if(this.rowsCounterSpan){this.onBeforeRefreshCounter&&this.onBeforeRefreshCounter.call(null,this,this.rowsCounterSpan);var b;if(this.paging){var c=parseInt(this.startPagingRow,10)+(this.nbVisibleRows>0?1:0),d=c+this.pagingLength-1<=this.nbVisibleRows?c+this.pagingLength-1:this.nbVisibleRows;b=c+this.fromToTextSeparator+d+this.overText+this.nbVisibleRows}else b=a&&""!==a?a:this.nbFilterableRows-this.nbHiddenRows-(this.hasVisibleRows?this.visibleRows.length:0);this.rowsCounterSpan.innerHTML=b,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,this,this.rowsCounterSpan,b)}},SetWatermark:function(a){if(this.fltGrid||""!==this.inpWatermark){a=void 0===a?!0:a;for(var b=0;b0&&this.tbl.removeChild(t[0]),this.headTbl.style.width=this.tbl.style.width,this.headTbl.style.tableLayout="fixed",this.tbl.style.tableLayout="fixed",this.headTbl.cellPadding=this.tbl.cellPadding,this.headTbl.cellSpacing=this.tbl.cellSpacing,this.headTblCont.style.width=this.tblCont.clientWidth+"px",this.SetColWidths(),this.tbl.style.width="",TF.isIE&&(this.headTbl.style.width="");var u=this;if(this.tblCont.onscroll=function(){u.headTblCont.scrollLeft=this.scrollLeft;var a=this;if(!u.isPointerXOverwritten)try{TF.Evt.pointerX=function(b){b=b||global.event;var c=tf_StandardBody().scrollLeft+a.scrollLeft;return b.pageX+a.scrollLeft||b.clientX+c},u.isPointerXOverwritten=!0}catch(b){u.isPointerXOverwritten=!1}},a.sort!==!1&&(this.sort=!0,this.sortConfig.asyncSort=!0,this.sortConfig.triggerIds=j),this.gridEnableColResizer&&(this.hasExtensions?this.__containsStr("colsresizer",str.lower(this.extensions.src.toString()))||(this.extensions.name.push("ColumnsResizer_"+this.id),this.extensions.src.push(this.gridColResizerPath),this.extensions.description.push("Columns Resizing"),this.extensions.initialize.push(function(a){a.SetColsResizer("ColumnsResizer_"+a.id)})):(this.extensions={name:["ColumnsResizer_"+this.id],src:[this.gridColResizerPath],description:["Columns Resizing"],initialize:[function(a){a.SetColsResizer("ColumnsResizer_"+a.id)}]},this.hasExtensions=!0)),a.col_resizer_cols_headers_table=this.headTbl.getAttribute("id"),a.col_resizer_cols_headers_index=this.gridHeadRowIndex,a.col_resizer_width_adjustment=0,a.col_enable_text_ellipsis=!1,u.tblHasColTag=TF.tag(u.tbl,"col").length>0?!0:!1,!TF.isIE){var v=function(a){if(a){for(var b=a.nbCells-1;b>=0;b--){var c=dom.create("col",["id",a.id+"_col_"+b]);a.tbl.firstChild.parentNode.insertBefore(c,a.tbl.firstChild),c.style.width=a.colWidth[b],a.gridColElms[b]=c}a.tblHasColTag=!0}};if(u.tblHasColTag)for(var w=TF.tag(u.tbl,"col"),x=0;x0?z[0].insertRow(0):u.tbl.insertRow(0),y.style.height="0px";for(var A=0;A0?z[0].moveRow(a.leadColWidthsRow.rowIndex,0):a.tbl.moveRow(a.leadColWidthsRow.rowIndex,0)}D&&D.call(null,a,b)}}var E=types.isFn(a.on_after_col_resized)?a.on_after_col_resized:null;a.on_after_col_resized=function(a,b){if(b){var c=a.crWColsRow.cells[b].style.width,d=a.gridColElms[b];d.style.width=c;var e=a.crWColsRow.cells[b].clientWidth,f=a.crWRowDataTbl.cells[b].clientWidth;TF.isIE&&(a.tbl.style.width=a.headTbl.clientWidth+"px"),e==f||TF.isIE||(a.headTbl.style.width=a.tbl.clientWidth+"px"),E&&E.call(null,a,b)}},this.tbl.clientWidth!==this.headTbl.clientWidth&&(this.tbl.style.width=this.headTbl.clientWidth+"px")}},RemoveGridLayout:function(){if(this.gridLayout){var a=this.tbl.parentNode.removeChild(this.tbl);this.tblMainCont.parentNode.insertBefore(a,this.tblMainCont),this.tblMainCont.parentNode.removeChild(this.tblMainCont),this.tblMainCont=null,this.headTblCont=null,this.headTbl=null,this.tblCont=null,this.tbl.outerHTML=this.sourceTblHtml,this.tbl=TF.id(this.id)}},SetPopupFilterIcons:function(){function a(a){var b=a||global.event,d=parseInt(this.getAttribute("ci"),10);if(c.CloseAllPopupFilters(d),c.TogglePopupFilter(d),c.popUpFltAdjustToContainer){var e=c.popUpFltElms[d],f=c.GetHeaderElement(d),g=.95*f.clientWidth;if(TF.isIE){var h=dom.position(f).left;e.style.left=h+"px"}e.style.width=parseInt(g,10)+"px"}b.cancel(b),b.stop(b)}if(this.popUpFilters){this.isExternalFlt=!0;var b=this.fObj;this.popUpImgFlt=b.popup_filters_image||this.themesPath+"icn_filter.gif",this.popUpImgFltActive=b.popup_filters_image_active||this.themesPath+"icn_filterActive.gif",this.popUpImgFltHtml=b.popup_filters_image_html||'Column filter',this.popUpDivCssClass=b.popup_div_css_class||"popUpFilter",this.onBeforePopUpOpen=types.isFn(b.on_before_popup_filter_open)?b.on_before_popup_filter_open:null,this.onAfterPopUpOpen=types.isFn(b.on_after_popup_filter_open)?b.on_after_popup_filter_open:null,this.onBeforePopUpClose=types.isFn(b.on_before_popup_filter_close)?b.on_before_popup_filter_close:null,this.onAfterPopUpClose=types.isFn(b.on_after_popup_filter_close)?b.on_after_popup_filter_close:null,this.externalFltTgtIds=[],this.popUpFltSpans=[],this.popUpFltImgs=[],this.popUpFltElms=this.popUpFltElmCache||[],this.popUpFltAdjustToContainer=!0;for(var c=this,d=0;de;e++){var f=a?e:this.validRowsIndex[e];this.SetRowBg(f,d),d++}},RemoveAlternateRows:function(){if(this.hasGrid){for(var a=(this.tbl.rows,this.refRow);a= offsetParent.offsetHeight ? 0 - parentNode.parentNode.offsetHeight + offsetParent.offsetHeight + offsetParent.scrollTop : 0);"}}}},RemoveFixedHeaders:function(){if(this.hasGrid&&this.fixedHeaders)if(this.contDiv){this.contDiv.parentNode.insertBefore(this.tbl,this.contDiv),this.contDiv.parentNode.removeChild(this.contDiv),this.contDiv=null;var a=TF.tag(this.tbl,"thead");if(0===a.length)return;var b=TF.tag(a[0],"tr");if(0===b.length)return;for(var c=0;cv):L?(w=formatDate(a.replace(i,""),D),e=w>=v):N?(w=formatDate(a.replace(j,""),D),e=v>=w):M?(w=formatDate(a.replace(l,""),D),e=v>w):O?(w=formatDate(a.replace(m,""),D),e=v.toString()!=w.toString()):P?(w=formatDate(a.replace(o,""),D),e=v.toString()==w.toString()):n.test(a)?e=f.__containsStr(a.replace(n,""),b,null,!1):isValidDate(a,D)?(w=formatDate(a,D),e=v.toString()==w.toString()):H?e=str.isEmpty(b):I&&(e=!str.isEmpty(b));else if(f.hasColNbFormat&&f.colNbFormat[c]?(g=removeNbFormat(b,f.colNbFormat[c]),h=f.colNbFormat[c]):","===f.thousandsSeparator&&"."===f.decimalSeparator?(g=removeNbFormat(b,"us"),h="us"):(g=removeNbFormat(b,"eu"),h="eu"),y)e=g<=removeNbFormat(a.replace(i,""),h);else if(A)e=g>=removeNbFormat(a.replace(j,""),h);else if(x)e=gremoveNbFormat(a.replace(l,""),h);else if(B)e=f.__containsStr(a.replace(m,""),b)?!1:!0;else if(E)e=f.__containsStr(a.replace(n,""),b,null,!1);else if(C)e=f.__containsStr(a.replace(o,""),b,null,!0);else if(F)e=0===b.indexOf(a.replace(p,""))?!0:!1;else if(G){var Q=a.replace(q,"");e=b.lastIndexOf(Q,b.length-1)===b.length-1-(Q.length-1)&&b.lastIndexOf(Q,b.length-1)>-1?!0:!1}else if(H)e=str.isEmpty(b);else if(I)e=!str.isEmpty(b);else if(J)try{var R=a.replace(u,""),S=new RegExp(R);e=S.test(b)}catch(T){e=!1}else{var U=d["col_"+c];e=f.__containsStr(a,b,U?U:this.fltTypeInp)}return e}if(this.fltGrid&&(this.hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),""!==this.inpWatermark&&this.SetWatermark(!1);var c=this.tbl.rows,d=this.fObj||{},e=0;this.validRowsIndex=[];var f=this;this.highlightKeywords&&this.UnhighlightAll(),this.popUpFilters&&this.SetAllPopupFiltersIcon(),this.markActiveColumns&&this.ClearActiveColumns(),this.searchArgs=this.GetFiltersValue();for(var g,h,i=new RegExp(this.leOperator),j=new RegExp(this.geOperator),k=new RegExp(this.lwOperator),l=new RegExp(this.grOperator),m=new RegExp(this.dfOperator),n=new RegExp(str.rgxEsc(this.lkOperator)),o=new RegExp(this.eqOperator),p=new RegExp(this.stOperator),q=new RegExp(this.enOperator),r=new RegExp(this.anOperator),s=(new RegExp(this.curExp),this.emOperator),t=this.nmOperator,u=new RegExp(str.rgxEsc(this.rgxOperator)),v=this.refRow;vB;B++){var C=this.searchArgs[this.singleSearchFlt?0:B],D=this.hasColDateType?this.colDateType[B]:this.defaultDateType;if(""!==C){var E=str.matchCase(this.GetCellData(B,w[B]),this.matchCase),F=C.split(this.orOperator),G=F.length>1?!0:!1,H=C.split(this.anOperator),I=H.length>1?!0:!1;if(G||I){for(var J,K=!1,L=G?F:H,M=0;Mj;j++)if(j===a&&""===d[f].style.display){var k=str.lower(this.GetCellData(j,h[j])),l=this.colNbFormat?this.colNbFormat[a]:null,m=b?removeNbFormat(k,l):k;e.push(m)}}return e}},GetFilterValue:function(a){if(this.fltGrid){var b,c=this.GetFilterElement(a);if(!c)return"";var d=this.fltCol[a];if(d!==this.fltTypeMulti&&d!==this.fltTypeCheckList)b=c.value;else if(d===this.fltTypeMulti){b="";for(var e=0;e=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==str.lower(typeof labelId)&&"object"==str.lower(typeof colIndex)&&"object"==str.lower(typeof operation))for(var row=this.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(this.GetColValues(ucolIndex[ucol],!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;kmaxValue?parseFloat(cvalue):maxValue))}if(1===meanFlag&&(meanValue=sumValue/nbvalues),1===medFlag){var aux=0;nbvalues%2===1?(aux=Math.floor(nbvalues/2),medValue=theList[aux]):medValue=(theList[nbvalues/2]+theList[nbvalues/2-1])/2}var posa;if(1===q1Flag&&(posa=0,posa=Math.floor(nbvalues/4),q1Value=4*posa==nbvalues?(theList[posa-1]+theList[posa])/2:theList[posa]),1===q3Flag){posa=0;var posb=0;posa=Math.floor(nbvalues/4),4*posa===nbvalues?(posb=3*posa,q3Value=(theList[posb]+theList[posb-1])/2):q3Value=theList[nbvalues-posa-1]}for(var i=0;mThisCol>=i;i++){switch(opsThisCol[i]){case"mean":result=meanValue;break;case"sum":result=sumValue;break;case"min":result=minValue;break;case"max":result=maxValue;break;case"median":result=medValue;break;case"q1":result=q1Value;break;case"q3":result=q3Value}var precision=decThisCol[i]&&!isNaN(decThisCol[i])?decThisCol[i]:2;if(oTypeThisCol&&result){if(result=result.toFixed(precision),TF.id(labThisCol[i]))switch(str.lower(oTypeThisCol)){case"innerhtml":TF.id(labThisCol[i]).innerHTML=isNaN(result)||!isFinite(result)||0===nbvalues?".":result;break;case"setvalue":TF.id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=TF.id(labThisCol[i]).firstChild,txtnode=dom.text(result);TF.id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{TF.id(labThisCol[i]).innerHTML=isNaN(result)||!isFinite(result)||0===nbvalues?".":result.toFixed(precision)}catch(e){}}totRowIndex&&row[totRowIndex[ucol]]&&(row[totRowIndex[ucol]].style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,this)}},UnhighlightAll:function(){if(this.highlightKeywords&&this.searchArgs){for(var a=0;a2){ - return yr; - } - var y; - //>50 belong to 1900 - if(yr <= 99 && yr>50){ - y = '19' + yr; - } - //<50 belong to 2000 - if(yr<50 || yr === '00'){ - y = '20' + yr; - } - return y; - } - - function mmm2mm(mmm){ - if(mmm === undefined){ - return 0; - } - var mondigit; - var MONTH_NAMES = [ - 'january','february','march','april','may','june','july', - 'august','september','october','november','december', - 'jan','feb','mar','apr','may','jun','jul','aug','sep','oct', - 'nov','dec' - ]; - for(var m_i=0; m_i < MONTH_NAMES.length; m_i++){ - var month_name = MONTH_NAMES[m_i]; - if (mmm.toLowerCase() === month_name){ - mondigit = m_i+1; - break; - } - } - if(mondigit > 11 || mondigit < 23){ - mondigit = mondigit - 12; - } - if(mondigit < 1 || mondigit > 12){ - return 0; - } - return mondigit; - } - - switch(format.toUpperCase()){ - case 'DDMMMYYYY': - parts = dateStr.replace(/[- \/.]/g,' ').split(' '); - oDate = new Date(y2kDate(parts[2]),mmm2mm(parts[1])-1,parts[0]); - break; - case 'DMY': - parts = dateStr.replace( - /^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,'$1 $3 $5').split(' '); - oDate = new Date(y2kDate(parts[2]),parts[1]-1,parts[0]); - break; - case 'MDY': - parts = dateStr.replace( - /^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,'$1 $3 $5').split(' '); - oDate = new Date(y2kDate(parts[2]),parts[0]-1,parts[1]); - break; - case 'YMD': - parts = dateStr.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,'$1 $4 $6').split(' '); - oDate = new Date(y2kDate(parts[0]),parts[1]-1,parts[2]); - break; - default: //in case format is not correct - parts = dateStr.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,'$1 $3 $5').split(' '); - oDate = new Date(y2kDate(parts[2]),parts[1]-1,parts[0]); - break; - } - return oDate; - } - }; - - return DateHelper; -}); diff --git a/dist/dom.js b/dist/dom.js deleted file mode 100644 index 06a11686..00000000 --- a/dist/dom.js +++ /dev/null @@ -1,155 +0,0 @@ -/** - * DOM utilities - */ - -define(function (require) { - 'use strict'; - - var Dom = {}; - - /** - * Returns text + text of children of given node - * @param {NodeElement} node - * @return {String} - */ - Dom.getText = function(node){ - var s = node.textContent || node.innerText || - node.innerHTML.replace(/<[^<>]+>/g, ''); - s = s.replace(/^\s+/, '').replace(/\s+$/, ''); - return s; - }; - - /** - * Creates an html element with given collection of attributes - * @param {String} tag a string of the html tag to create - * @param {Array} an undetermined number of arrays containing the with 2 - * items, the attribute name and its value ['id','myId'] - * @return {Object} created element - */ - Dom.create = function(tag){ - if(!tag || tag===''){ - return; - } - - var el = document.createElement(tag), - args = arguments; - - if(args.length > 1){ - for(var i=0; i -1; i -= 1) { - if (ary[i] && func(ary[i], i, ary)) { - break; - } - } - } - } - - function hasProp(obj, prop) { - return hasOwn.call(obj, prop); - } - - function getOwn(obj, prop) { - return hasProp(obj, prop) && obj[prop]; - } - - /** - * Cycles over properties in an object and calls a function for each - * property value. If the function returns a truthy value, then the - * iteration is stopped. - */ - function eachProp(obj, func) { - var prop; - for (prop in obj) { - if (hasProp(obj, prop)) { - if (func(obj[prop], prop)) { - break; - } - } - } - } - - /** - * Simple function to mix in properties from source into target, - * but only if target does not already have a property of the same name. - */ - function mixin(target, source, force, deepStringMixin) { - if (source) { - eachProp(source, function (value, prop) { - if (force || !hasProp(target, prop)) { - if (deepStringMixin && typeof value === 'object' && value && - !isArray(value) && !isFunction(value) && - !(value instanceof RegExp)) { - - if (!target[prop]) { - target[prop] = {}; - } - mixin(target[prop], value, force, deepStringMixin); - } else { - target[prop] = value; - } - } - }); - } - return target; - } - - //Similar to Function.prototype.bind, but the 'this' object is specified - //first, since it is easier to read/figure out what 'this' will be. - function bind(obj, fn) { - return function () { - return fn.apply(obj, arguments); - }; - } - - function scripts() { - return document.getElementsByTagName('script'); - } - - function defaultOnError(err) { - throw err; - } - - //Allow getting a global that is expressed in - //dot notation, like 'a.b.c'. - function getGlobal(value) { - if (!value) { - return value; - } - var g = global; - each(value.split('.'), function (part) { - g = g[part]; - }); - return g; - } - - /** - * Constructs an error with a pointer to an URL with more information. - * @param {String} id the error ID that maps to an ID on a web page. - * @param {String} message human readable error. - * @param {Error} [err] the original error, if there is one. - * - * @returns {Error} - */ - function makeError(id, msg, err, requireModules) { - var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id); - e.requireType = id; - e.requireModules = requireModules; - if (err) { - e.originalError = err; - } - return e; - } - - if (typeof define !== 'undefined') { - //If a define is already in play via another AMD loader, - //do not overwrite. - return; - } - - if (typeof requirejs !== 'undefined') { - if (isFunction(requirejs)) { - //Do not overwrite an existing requirejs instance. - return; - } - cfg = requirejs; - requirejs = undefined; - } - - //Allow for a require config object - if (typeof require !== 'undefined' && !isFunction(require)) { - //assume it is a config object. - cfg = require; - require = undefined; - } - - function newContext(contextName) { - var inCheckLoaded, Module, context, handlers, - checkLoadedTimeoutId, - config = { - //Defaults. Do not set a default for map - //config to speed up normalize(), which - //will run faster if there is no default. - waitSeconds: 7, - baseUrl: './', - paths: {}, - bundles: {}, - pkgs: {}, - shim: {}, - config: {} - }, - registry = {}, - //registry of just enabled modules, to speed - //cycle breaking code when lots of modules - //are registered, but not activated. - enabledRegistry = {}, - undefEvents = {}, - defQueue = [], - defined = {}, - urlFetched = {}, - bundlesMap = {}, - requireCounter = 1, - unnormalizedCounter = 1; - - /** - * Trims the . and .. from an array of path segments. - * It will keep a leading path segment if a .. will become - * the first path segment, to help with module name lookups, - * which act like paths, but can be remapped. But the end result, - * all paths that use this function should look normalized. - * NOTE: this method MODIFIES the input array. - * @param {Array} ary the array of path segments. - */ - function trimDots(ary) { - var i, part; - for (i = 0; i < ary.length; i++) { - part = ary[i]; - if (part === '.') { - ary.splice(i, 1); - i -= 1; - } else if (part === '..') { - // If at the start, or previous value is still .., - // keep them so that when converted to a path it may - // still work when converted to a path, even though - // as an ID it is less than ideal. In larger point - // releases, may be better to just kick out an error. - if (i === 0 || (i == 1 && ary[2] === '..') || ary[i - 1] === '..') { - continue; - } else if (i > 0) { - ary.splice(i - 1, 2); - i -= 2; - } - } - } - } - - /** - * Given a relative module name, like ./something, normalize it to - * a real name that can be mapped to a path. - * @param {String} name the relative name - * @param {String} baseName a real name that the name arg is relative - * to. - * @param {Boolean} applyMap apply the map config to the value. Should - * only be done if this normalization is for a dependency ID. - * @returns {String} normalized name - */ - function normalize(name, baseName, applyMap) { - var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex, - foundMap, foundI, foundStarMap, starI, normalizedBaseParts, - baseParts = (baseName && baseName.split('/')), - map = config.map, - starMap = map && map['*']; - - //Adjust any relative paths. - if (name) { - name = name.split('/'); - lastIndex = name.length - 1; - - // If wanting node ID compatibility, strip .js from end - // of IDs. Have to do this here, and not in nameToUrl - // because node allows either .js or non .js to map - // to same file. - if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { - name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); - } - - // Starts with a '.' so need the baseName - if (name[0].charAt(0) === '.' && baseParts) { - //Convert baseName to array, and lop off the last part, - //so that . matches that 'directory' and not name of the baseName's - //module. For instance, baseName of 'one/two/three', maps to - //'one/two/three.js', but we want the directory, 'one/two' for - //this normalization. - normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); - name = normalizedBaseParts.concat(name); - } - - trimDots(name); - name = name.join('/'); - } - - //Apply map config if available. - if (applyMap && map && (baseParts || starMap)) { - nameParts = name.split('/'); - - outerLoop: for (i = nameParts.length; i > 0; i -= 1) { - nameSegment = nameParts.slice(0, i).join('/'); - - if (baseParts) { - //Find the longest baseName segment match in the config. - //So, do joins on the biggest to smallest lengths of baseParts. - for (j = baseParts.length; j > 0; j -= 1) { - mapValue = getOwn(map, baseParts.slice(0, j).join('/')); - - //baseName segment has config, find if it has one for - //this name. - if (mapValue) { - mapValue = getOwn(mapValue, nameSegment); - if (mapValue) { - //Match, update name to the new value. - foundMap = mapValue; - foundI = i; - break outerLoop; - } - } - } - } - - //Check for a star map match, but just hold on to it, - //if there is a shorter segment match later in a matching - //config, then favor over this star map. - if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) { - foundStarMap = getOwn(starMap, nameSegment); - starI = i; - } - } - - if (!foundMap && foundStarMap) { - foundMap = foundStarMap; - foundI = starI; - } - - if (foundMap) { - nameParts.splice(0, foundI, foundMap); - name = nameParts.join('/'); - } - } - - // If the name points to a package's name, use - // the package main instead. - pkgMain = getOwn(config.pkgs, name); - - return pkgMain ? pkgMain : name; - } - - function removeScript(name) { - if (isBrowser) { - each(scripts(), function (scriptNode) { - if (scriptNode.getAttribute('data-requiremodule') === name && - scriptNode.getAttribute('data-requirecontext') === context.contextName) { - scriptNode.parentNode.removeChild(scriptNode); - return true; - } - }); - } - } - - function hasPathFallback(id) { - var pathConfig = getOwn(config.paths, id); - if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) { - //Pop off the first array value, since it failed, and - //retry - pathConfig.shift(); - context.require.undef(id); - - //Custom require that does not do map translation, since - //ID is "absolute", already mapped/resolved. - context.makeRequire(null, { - skipMap: true - })([id]); - - return true; - } - } - - //Turns a plugin!resource to [plugin, resource] - //with the plugin being undefined if the name - //did not have a plugin prefix. - function splitPrefix(name) { - var prefix, - index = name ? name.indexOf('!') : -1; - if (index > -1) { - prefix = name.substring(0, index); - name = name.substring(index + 1, name.length); - } - return [prefix, name]; - } - - /** - * Creates a module mapping that includes plugin prefix, module - * name, and path. If parentModuleMap is provided it will - * also normalize the name via require.normalize() - * - * @param {String} name the module name - * @param {String} [parentModuleMap] parent module map - * for the module name, used to resolve relative names. - * @param {Boolean} isNormalized: is the ID already normalized. - * This is true if this call is done for a define() module ID. - * @param {Boolean} applyMap: apply the map config to the ID. - * Should only be true if this map is for a dependency. - * - * @returns {Object} - */ - function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) { - var url, pluginModule, suffix, nameParts, - prefix = null, - parentName = parentModuleMap ? parentModuleMap.name : null, - originalName = name, - isDefine = true, - normalizedName = ''; - - //If no name, then it means it is a require call, generate an - //internal name. - if (!name) { - isDefine = false; - name = '_@r' + (requireCounter += 1); - } - - nameParts = splitPrefix(name); - prefix = nameParts[0]; - name = nameParts[1]; - - if (prefix) { - prefix = normalize(prefix, parentName, applyMap); - pluginModule = getOwn(defined, prefix); - } - - //Account for relative paths if there is a base name. - if (name) { - if (prefix) { - if (pluginModule && pluginModule.normalize) { - //Plugin is loaded, use its normalize method. - normalizedName = pluginModule.normalize(name, function (name) { - return normalize(name, parentName, applyMap); - }); - } else { - // If nested plugin references, then do not try to - // normalize, as it will not normalize correctly. This - // places a restriction on resourceIds, and the longer - // term solution is not to normalize until plugins are - // loaded and all normalizations to allow for async - // loading of a loader plugin. But for now, fixes the - // common uses. Details in #1131 - normalizedName = name.indexOf('!') === -1 ? - normalize(name, parentName, applyMap) : - name; - } - } else { - //A regular module. - normalizedName = normalize(name, parentName, applyMap); - - //Normalized name may be a plugin ID due to map config - //application in normalize. The map config values must - //already be normalized, so do not need to redo that part. - nameParts = splitPrefix(normalizedName); - prefix = nameParts[0]; - normalizedName = nameParts[1]; - isNormalized = true; - - url = context.nameToUrl(normalizedName); - } - } - - //If the id is a plugin id that cannot be determined if it needs - //normalization, stamp it with a unique ID so two matching relative - //ids that may conflict can be separate. - suffix = prefix && !pluginModule && !isNormalized ? - '_unnormalized' + (unnormalizedCounter += 1) : - ''; - - return { - prefix: prefix, - name: normalizedName, - parentMap: parentModuleMap, - unnormalized: !!suffix, - url: url, - originalName: originalName, - isDefine: isDefine, - id: (prefix ? - prefix + '!' + normalizedName : - normalizedName) + suffix - }; - } - - function getModule(depMap) { - var id = depMap.id, - mod = getOwn(registry, id); - - if (!mod) { - mod = registry[id] = new context.Module(depMap); - } - - return mod; - } - - function on(depMap, name, fn) { - var id = depMap.id, - mod = getOwn(registry, id); - - if (hasProp(defined, id) && - (!mod || mod.defineEmitComplete)) { - if (name === 'defined') { - fn(defined[id]); - } - } else { - mod = getModule(depMap); - if (mod.error && name === 'error') { - fn(mod.error); - } else { - mod.on(name, fn); - } - } - } - - function onError(err, errback) { - var ids = err.requireModules, - notified = false; - - if (errback) { - errback(err); - } else { - each(ids, function (id) { - var mod = getOwn(registry, id); - if (mod) { - //Set error on module, so it skips timeout checks. - mod.error = err; - if (mod.events.error) { - notified = true; - mod.emit('error', err); - } - } - }); - - if (!notified) { - req.onError(err); - } - } - } - - /** - * Internal method to transfer globalQueue items to this context's - * defQueue. - */ - function takeGlobalQueue() { - //Push all the globalDefQueue items into the context's defQueue - if (globalDefQueue.length) { - //Array splice in the values since the context code has a - //local var ref to defQueue, so cannot just reassign the one - //on context. - apsp.apply(defQueue, - [defQueue.length, 0].concat(globalDefQueue)); - globalDefQueue = []; - } - } - - handlers = { - 'require': function (mod) { - if (mod.require) { - return mod.require; - } else { - return (mod.require = context.makeRequire(mod.map)); - } - }, - 'exports': function (mod) { - mod.usingExports = true; - if (mod.map.isDefine) { - if (mod.exports) { - return (defined[mod.map.id] = mod.exports); - } else { - return (mod.exports = defined[mod.map.id] = {}); - } - } - }, - 'module': function (mod) { - if (mod.module) { - return mod.module; - } else { - return (mod.module = { - id: mod.map.id, - uri: mod.map.url, - config: function () { - return getOwn(config.config, mod.map.id) || {}; - }, - exports: mod.exports || (mod.exports = {}) - }); - } - } - }; - - function cleanRegistry(id) { - //Clean up machinery used for waiting modules. - delete registry[id]; - delete enabledRegistry[id]; - } - - function breakCycle(mod, traced, processed) { - var id = mod.map.id; - - if (mod.error) { - mod.emit('error', mod.error); - } else { - traced[id] = true; - each(mod.depMaps, function (depMap, i) { - var depId = depMap.id, - dep = getOwn(registry, depId); - - //Only force things that have not completed - //being defined, so still in the registry, - //and only if it has not been matched up - //in the module already. - if (dep && !mod.depMatched[i] && !processed[depId]) { - if (getOwn(traced, depId)) { - mod.defineDep(i, defined[depId]); - mod.check(); //pass false? - } else { - breakCycle(dep, traced, processed); - } - } - }); - processed[id] = true; - } - } - - function checkLoaded() { - var err, usingPathFallback, - waitInterval = config.waitSeconds * 1000, - //It is possible to disable the wait interval by using waitSeconds of 0. - expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(), - noLoads = [], - reqCalls = [], - stillLoading = false, - needCycleCheck = true; - - //Do not bother if this call was a result of a cycle break. - if (inCheckLoaded) { - return; - } - - inCheckLoaded = true; - - //Figure out the state of all the modules. - eachProp(enabledRegistry, function (mod) { - var map = mod.map, - modId = map.id; - - //Skip things that are not enabled or in error state. - if (!mod.enabled) { - return; - } - - if (!map.isDefine) { - reqCalls.push(mod); - } - - if (!mod.error) { - //If the module should be executed, and it has not - //been inited and time is up, remember it. - if (!mod.inited && expired) { - if (hasPathFallback(modId)) { - usingPathFallback = true; - stillLoading = true; - } else { - noLoads.push(modId); - removeScript(modId); - } - } else if (!mod.inited && mod.fetched && map.isDefine) { - stillLoading = true; - if (!map.prefix) { - //No reason to keep looking for unfinished - //loading. If the only stillLoading is a - //plugin resource though, keep going, - //because it may be that a plugin resource - //is waiting on a non-plugin cycle. - return (needCycleCheck = false); - } - } - } - }); - - if (expired && noLoads.length) { - //If wait time expired, throw error of unloaded modules. - err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads); - err.contextName = context.contextName; - return onError(err); - } - - //Not expired, check for a cycle. - if (needCycleCheck) { - each(reqCalls, function (mod) { - breakCycle(mod, {}, {}); - }); - } - - //If still waiting on loads, and the waiting load is something - //other than a plugin resource, or there are still outstanding - //scripts, then just try back later. - if ((!expired || usingPathFallback) && stillLoading) { - //Something is still waiting to load. Wait for it, but only - //if a timeout is not already in effect. - if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) { - checkLoadedTimeoutId = setTimeout(function () { - checkLoadedTimeoutId = 0; - checkLoaded(); - }, 50); - } - } - - inCheckLoaded = false; - } - - Module = function (map) { - this.events = getOwn(undefEvents, map.id) || {}; - this.map = map; - this.shim = getOwn(config.shim, map.id); - this.depExports = []; - this.depMaps = []; - this.depMatched = []; - this.pluginMaps = {}; - this.depCount = 0; - - /* this.exports this.factory - this.depMaps = [], - this.enabled, this.fetched - */ - }; - - Module.prototype = { - init: function (depMaps, factory, errback, options) { - options = options || {}; - - //Do not do more inits if already done. Can happen if there - //are multiple define calls for the same module. That is not - //a normal, common case, but it is also not unexpected. - if (this.inited) { - return; - } - - this.factory = factory; - - if (errback) { - //Register for errors on this module. - this.on('error', errback); - } else if (this.events.error) { - //If no errback already, but there are error listeners - //on this module, set up an errback to pass to the deps. - errback = bind(this, function (err) { - this.emit('error', err); - }); - } - - //Do a copy of the dependency array, so that - //source inputs are not modified. For example - //"shim" deps are passed in here directly, and - //doing a direct modification of the depMaps array - //would affect that config. - this.depMaps = depMaps && depMaps.slice(0); - - this.errback = errback; - - //Indicate this module has be initialized - this.inited = true; - - this.ignore = options.ignore; - - //Could have option to init this module in enabled mode, - //or could have been previously marked as enabled. However, - //the dependencies are not known until init is called. So - //if enabled previously, now trigger dependencies as enabled. - if (options.enabled || this.enabled) { - //Enable this module and dependencies. - //Will call this.check() - this.enable(); - } else { - this.check(); - } - }, - - defineDep: function (i, depExports) { - //Because of cycles, defined callback for a given - //export can be called more than once. - if (!this.depMatched[i]) { - this.depMatched[i] = true; - this.depCount -= 1; - this.depExports[i] = depExports; - } - }, - - fetch: function () { - if (this.fetched) { - return; - } - this.fetched = true; - - context.startTime = (new Date()).getTime(); - - var map = this.map; - - //If the manager is for a plugin managed resource, - //ask the plugin to load it now. - if (this.shim) { - context.makeRequire(this.map, { - enableBuildCallback: true - })(this.shim.deps || [], bind(this, function () { - return map.prefix ? this.callPlugin() : this.load(); - })); - } else { - //Regular dependency. - return map.prefix ? this.callPlugin() : this.load(); - } - }, - - load: function () { - var url = this.map.url; - - //Regular dependency. - if (!urlFetched[url]) { - urlFetched[url] = true; - context.load(this.map.id, url); - } - }, - - /** - * Checks if the module is ready to define itself, and if so, - * define it. - */ - check: function () { - if (!this.enabled || this.enabling) { - return; - } - - var err, cjsModule, - id = this.map.id, - depExports = this.depExports, - exports = this.exports, - factory = this.factory; - - if (!this.inited) { - this.fetch(); - } else if (this.error) { - this.emit('error', this.error); - } else if (!this.defining) { - //The factory could trigger another require call - //that would result in checking this module to - //define itself again. If already in the process - //of doing that, skip this work. - this.defining = true; - - if (this.depCount < 1 && !this.defined) { - if (isFunction(factory)) { - //If there is an error listener, favor passing - //to that instead of throwing an error. However, - //only do it for define()'d modules. require - //errbacks should not be called for failures in - //their callbacks (#699). However if a global - //onError is set, use that. - if ((this.events.error && this.map.isDefine) || - req.onError !== defaultOnError) { - try { - exports = context.execCb(id, factory, depExports, exports); - } catch (e) { - err = e; - } - } else { - exports = context.execCb(id, factory, depExports, exports); - } - - // Favor return value over exports. If node/cjs in play, - // then will not have a return value anyway. Favor - // module.exports assignment over exports object. - if (this.map.isDefine && exports === undefined) { - cjsModule = this.module; - if (cjsModule) { - exports = cjsModule.exports; - } else if (this.usingExports) { - //exports already set the defined value. - exports = this.exports; - } - } - - if (err) { - err.requireMap = this.map; - err.requireModules = this.map.isDefine ? [this.map.id] : null; - err.requireType = this.map.isDefine ? 'define' : 'require'; - return onError((this.error = err)); - } - - } else { - //Just a literal value - exports = factory; - } - - this.exports = exports; - - if (this.map.isDefine && !this.ignore) { - defined[id] = exports; - - if (req.onResourceLoad) { - req.onResourceLoad(context, this.map, this.depMaps); - } - } - - //Clean up - cleanRegistry(id); - - this.defined = true; - } - - //Finished the define stage. Allow calling check again - //to allow define notifications below in the case of a - //cycle. - this.defining = false; - - if (this.defined && !this.defineEmitted) { - this.defineEmitted = true; - this.emit('defined', this.exports); - this.defineEmitComplete = true; - } - - } - }, - - callPlugin: function () { - var map = this.map, - id = map.id, - //Map already normalized the prefix. - pluginMap = makeModuleMap(map.prefix); - - //Mark this as a dependency for this plugin, so it - //can be traced for cycles. - this.depMaps.push(pluginMap); - - on(pluginMap, 'defined', bind(this, function (plugin) { - var load, normalizedMap, normalizedMod, - bundleId = getOwn(bundlesMap, this.map.id), - name = this.map.name, - parentName = this.map.parentMap ? this.map.parentMap.name : null, - localRequire = context.makeRequire(map.parentMap, { - enableBuildCallback: true - }); - - //If current map is not normalized, wait for that - //normalized name to load instead of continuing. - if (this.map.unnormalized) { - //Normalize the ID if the plugin allows it. - if (plugin.normalize) { - name = plugin.normalize(name, function (name) { - return normalize(name, parentName, true); - }) || ''; - } - - //prefix and name should already be normalized, no need - //for applying map config again either. - normalizedMap = makeModuleMap(map.prefix + '!' + name, - this.map.parentMap); - on(normalizedMap, - 'defined', bind(this, function (value) { - this.init([], function () { return value; }, null, { - enabled: true, - ignore: true - }); - })); - - normalizedMod = getOwn(registry, normalizedMap.id); - if (normalizedMod) { - //Mark this as a dependency for this plugin, so it - //can be traced for cycles. - this.depMaps.push(normalizedMap); - - if (this.events.error) { - normalizedMod.on('error', bind(this, function (err) { - this.emit('error', err); - })); - } - normalizedMod.enable(); - } - - return; - } - - //If a paths config, then just load that file instead to - //resolve the plugin, as it is built into that paths layer. - if (bundleId) { - this.map.url = context.nameToUrl(bundleId); - this.load(); - return; - } - - load = bind(this, function (value) { - this.init([], function () { return value; }, null, { - enabled: true - }); - }); - - load.error = bind(this, function (err) { - this.inited = true; - this.error = err; - err.requireModules = [id]; - - //Remove temp unnormalized modules for this module, - //since they will never be resolved otherwise now. - eachProp(registry, function (mod) { - if (mod.map.id.indexOf(id + '_unnormalized') === 0) { - cleanRegistry(mod.map.id); - } - }); - - onError(err); - }); - - //Allow plugins to load other code without having to know the - //context or how to 'complete' the load. - load.fromText = bind(this, function (text, textAlt) { - /*jslint evil: true */ - var moduleName = map.name, - moduleMap = makeModuleMap(moduleName), - hasInteractive = useInteractive; - - //As of 2.1.0, support just passing the text, to reinforce - //fromText only being called once per resource. Still - //support old style of passing moduleName but discard - //that moduleName in favor of the internal ref. - if (textAlt) { - text = textAlt; - } - - //Turn off interactive script matching for IE for any define - //calls in the text, then turn it back on at the end. - if (hasInteractive) { - useInteractive = false; - } - - //Prime the system by creating a module instance for - //it. - getModule(moduleMap); - - //Transfer any config to this other module. - if (hasProp(config.config, id)) { - config.config[moduleName] = config.config[id]; - } - - try { - req.exec(text); - } catch (e) { - return onError(makeError('fromtexteval', - 'fromText eval for ' + id + - ' failed: ' + e, - e, - [id])); - } - - if (hasInteractive) { - useInteractive = true; - } - - //Mark this as a dependency for the plugin - //resource - this.depMaps.push(moduleMap); - - //Support anonymous modules. - context.completeLoad(moduleName); - - //Bind the value of that module to the value for this - //resource ID. - localRequire([moduleName], load); - }); - - //Use parentName here since the plugin's name is not reliable, - //could be some weird string with no path that actually wants to - //reference the parentName's path. - plugin.load(map.name, localRequire, load, config); - })); - - context.enable(pluginMap, this); - this.pluginMaps[pluginMap.id] = pluginMap; - }, - - enable: function () { - enabledRegistry[this.map.id] = this; - this.enabled = true; - - //Set flag mentioning that the module is enabling, - //so that immediate calls to the defined callbacks - //for dependencies do not trigger inadvertent load - //with the depCount still being zero. - this.enabling = true; - - //Enable each dependency - each(this.depMaps, bind(this, function (depMap, i) { - var id, mod, handler; - - if (typeof depMap === 'string') { - //Dependency needs to be converted to a depMap - //and wired up to this module. - depMap = makeModuleMap(depMap, - (this.map.isDefine ? this.map : this.map.parentMap), - false, - !this.skipMap); - this.depMaps[i] = depMap; - - handler = getOwn(handlers, depMap.id); - - if (handler) { - this.depExports[i] = handler(this); - return; - } - - this.depCount += 1; - - on(depMap, 'defined', bind(this, function (depExports) { - this.defineDep(i, depExports); - this.check(); - })); - - if (this.errback) { - on(depMap, 'error', bind(this, this.errback)); - } - } - - id = depMap.id; - mod = registry[id]; - - //Skip special modules like 'require', 'exports', 'module' - //Also, don't call enable if it is already enabled, - //important in circular dependency cases. - if (!hasProp(handlers, id) && mod && !mod.enabled) { - context.enable(depMap, this); - } - })); - - //Enable each plugin that is used in - //a dependency - eachProp(this.pluginMaps, bind(this, function (pluginMap) { - var mod = getOwn(registry, pluginMap.id); - if (mod && !mod.enabled) { - context.enable(pluginMap, this); - } - })); - - this.enabling = false; - - this.check(); - }, - - on: function (name, cb) { - var cbs = this.events[name]; - if (!cbs) { - cbs = this.events[name] = []; - } - cbs.push(cb); - }, - - emit: function (name, evt) { - each(this.events[name], function (cb) { - cb(evt); - }); - if (name === 'error') { - //Now that the error handler was triggered, remove - //the listeners, since this broken Module instance - //can stay around for a while in the registry. - delete this.events[name]; - } - } - }; - - function callGetModule(args) { - //Skip modules already defined. - if (!hasProp(defined, args[0])) { - getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]); - } - } - - function removeListener(node, func, name, ieName) { - //Favor detachEvent because of IE9 - //issue, see attachEvent/addEventListener comment elsewhere - //in this file. - if (node.detachEvent && !isOpera) { - //Probably IE. If not it will throw an error, which will be - //useful to know. - if (ieName) { - node.detachEvent(ieName, func); - } - } else { - node.removeEventListener(name, func, false); - } - } - - /** - * Given an event from a script node, get the requirejs info from it, - * and then removes the event listeners on the node. - * @param {Event} evt - * @returns {Object} - */ - function getScriptData(evt) { - //Using currentTarget instead of target for Firefox 2.0's sake. Not - //all old browsers will be supported, but this one was easy enough - //to support and still makes sense. - var node = evt.currentTarget || evt.srcElement; - - //Remove the listeners once here. - removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange'); - removeListener(node, context.onScriptError, 'error'); - - return { - node: node, - id: node && node.getAttribute('data-requiremodule') - }; - } - - function intakeDefines() { - var args; - - //Any defined modules in the global queue, intake them now. - takeGlobalQueue(); - - //Make sure any remaining defQueue items get properly processed. - while (defQueue.length) { - args = defQueue.shift(); - if (args[0] === null) { - return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1])); - } else { - //args are id, deps, factory. Should be normalized by the - //define() function. - callGetModule(args); - } - } - } - - context = { - config: config, - contextName: contextName, - registry: registry, - defined: defined, - urlFetched: urlFetched, - defQueue: defQueue, - Module: Module, - makeModuleMap: makeModuleMap, - nextTick: req.nextTick, - onError: onError, - - /** - * Set a configuration for the context. - * @param {Object} cfg config object to integrate. - */ - configure: function (cfg) { - //Make sure the baseUrl ends in a slash. - if (cfg.baseUrl) { - if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') { - cfg.baseUrl += '/'; - } - } - - //Save off the paths since they require special processing, - //they are additive. - var shim = config.shim, - objs = { - paths: true, - bundles: true, - config: true, - map: true - }; - - eachProp(cfg, function (value, prop) { - if (objs[prop]) { - if (!config[prop]) { - config[prop] = {}; - } - mixin(config[prop], value, true, true); - } else { - config[prop] = value; - } - }); - - //Reverse map the bundles - if (cfg.bundles) { - eachProp(cfg.bundles, function (value, prop) { - each(value, function (v) { - if (v !== prop) { - bundlesMap[v] = prop; - } - }); - }); - } - - //Merge shim - if (cfg.shim) { - eachProp(cfg.shim, function (value, id) { - //Normalize the structure - if (isArray(value)) { - value = { - deps: value - }; - } - if ((value.exports || value.init) && !value.exportsFn) { - value.exportsFn = context.makeShimExports(value); - } - shim[id] = value; - }); - config.shim = shim; - } - - //Adjust packages if necessary. - if (cfg.packages) { - each(cfg.packages, function (pkgObj) { - var location, name; - - pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj; - - name = pkgObj.name; - location = pkgObj.location; - if (location) { - config.paths[name] = pkgObj.location; - } - - //Save pointer to main module ID for pkg name. - //Remove leading dot in main, so main paths are normalized, - //and remove any trailing .js, since different package - //envs have different conventions: some use a module name, - //some use a file name. - config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main') - .replace(currDirRegExp, '') - .replace(jsSuffixRegExp, ''); - }); - } - - //If there are any "waiting to execute" modules in the registry, - //update the maps for them, since their info, like URLs to load, - //may have changed. - eachProp(registry, function (mod, id) { - //If module already has init called, since it is too - //late to modify them, and ignore unnormalized ones - //since they are transient. - if (!mod.inited && !mod.map.unnormalized) { - mod.map = makeModuleMap(id); - } - }); - - //If a deps array or a config callback is specified, then call - //require with those args. This is useful when require is defined as a - //config object before require.js is loaded. - if (cfg.deps || cfg.callback) { - context.require(cfg.deps || [], cfg.callback); - } - }, - - makeShimExports: function (value) { - function fn() { - var ret; - if (value.init) { - ret = value.init.apply(global, arguments); - } - return ret || (value.exports && getGlobal(value.exports)); - } - return fn; - }, - - makeRequire: function (relMap, options) { - options = options || {}; - - function localRequire(deps, callback, errback) { - var id, map, requireMod; - - if (options.enableBuildCallback && callback && isFunction(callback)) { - callback.__requireJsBuild = true; - } - - if (typeof deps === 'string') { - if (isFunction(callback)) { - //Invalid call - return onError(makeError('requireargs', 'Invalid require call'), errback); - } - - //If require|exports|module are requested, get the - //value for them from the special handlers. Caveat: - //this only works while module is being defined. - if (relMap && hasProp(handlers, deps)) { - return handlers[deps](registry[relMap.id]); - } - - //Synchronous access to one module. If require.get is - //available (as in the Node adapter), prefer that. - if (req.get) { - return req.get(context, deps, relMap, localRequire); - } - - //Normalize module name, if it contains . or .. - map = makeModuleMap(deps, relMap, false, true); - id = map.id; - - if (!hasProp(defined, id)) { - return onError(makeError('notloaded', 'Module name "' + - id + - '" has not been loaded yet for context: ' + - contextName + - (relMap ? '' : '. Use require([])'))); - } - return defined[id]; - } - - //Grab defines waiting in the global queue. - intakeDefines(); - - //Mark all the dependencies as needing to be loaded. - context.nextTick(function () { - //Some defines could have been added since the - //require call, collect them. - intakeDefines(); - - requireMod = getModule(makeModuleMap(null, relMap)); - - //Store if map config should be applied to this require - //call for dependencies. - requireMod.skipMap = options.skipMap; - - requireMod.init(deps, callback, errback, { - enabled: true - }); - - checkLoaded(); - }); - - return localRequire; - } - - mixin(localRequire, { - isBrowser: isBrowser, - - /** - * Converts a module name + .extension into an URL path. - * *Requires* the use of a module name. It does not support using - * plain URLs like nameToUrl. - */ - toUrl: function (moduleNamePlusExt) { - var ext, - index = moduleNamePlusExt.lastIndexOf('.'), - segment = moduleNamePlusExt.split('/')[0], - isRelative = segment === '.' || segment === '..'; - - //Have a file extension alias, and it is not the - //dots from a relative path. - if (index !== -1 && (!isRelative || index > 1)) { - ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length); - moduleNamePlusExt = moduleNamePlusExt.substring(0, index); - } - - return context.nameToUrl(normalize(moduleNamePlusExt, - relMap && relMap.id, true), ext, true); - }, - - defined: function (id) { - return hasProp(defined, makeModuleMap(id, relMap, false, true).id); - }, - - specified: function (id) { - id = makeModuleMap(id, relMap, false, true).id; - return hasProp(defined, id) || hasProp(registry, id); - } - }); - - //Only allow undef on top level require calls - if (!relMap) { - localRequire.undef = function (id) { - //Bind any waiting define() calls to this context, - //fix for #408 - takeGlobalQueue(); - - var map = makeModuleMap(id, relMap, true), - mod = getOwn(registry, id); - - removeScript(id); - - delete defined[id]; - delete urlFetched[map.url]; - delete undefEvents[id]; - - //Clean queued defines too. Go backwards - //in array so that the splices do not - //mess up the iteration. - eachReverse(defQueue, function(args, i) { - if(args[0] === id) { - defQueue.splice(i, 1); - } - }); - - if (mod) { - //Hold on to listeners in case the - //module will be attempted to be reloaded - //using a different config. - if (mod.events.defined) { - undefEvents[id] = mod.events; - } - - cleanRegistry(id); - } - }; - } - - return localRequire; - }, - - /** - * Called to enable a module if it is still in the registry - * awaiting enablement. A second arg, parent, the parent module, - * is passed in for context, when this method is overridden by - * the optimizer. Not shown here to keep code compact. - */ - enable: function (depMap) { - var mod = getOwn(registry, depMap.id); - if (mod) { - getModule(depMap).enable(); - } - }, - - /** - * Internal method used by environment adapters to complete a load event. - * A load event could be a script load or just a load pass from a synchronous - * load call. - * @param {String} moduleName the name of the module to potentially complete. - */ - completeLoad: function (moduleName) { - var found, args, mod, - shim = getOwn(config.shim, moduleName) || {}, - shExports = shim.exports; - - takeGlobalQueue(); - - while (defQueue.length) { - args = defQueue.shift(); - if (args[0] === null) { - args[0] = moduleName; - //If already found an anonymous module and bound it - //to this name, then this is some other anon module - //waiting for its completeLoad to fire. - if (found) { - break; - } - found = true; - } else if (args[0] === moduleName) { - //Found matching define call for this script! - found = true; - } - - callGetModule(args); - } - - //Do this after the cycle of callGetModule in case the result - //of those calls/init calls changes the registry. - mod = getOwn(registry, moduleName); - - if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) { - if (config.enforceDefine && (!shExports || !getGlobal(shExports))) { - if (hasPathFallback(moduleName)) { - return; - } else { - return onError(makeError('nodefine', - 'No define call for ' + moduleName, - null, - [moduleName])); - } - } else { - //A script that does not call define(), so just simulate - //the call for it. - callGetModule([moduleName, (shim.deps || []), shim.exportsFn]); - } - } - - checkLoaded(); - }, - - /** - * Converts a module name to a file path. Supports cases where - * moduleName may actually be just an URL. - * Note that it **does not** call normalize on the moduleName, - * it is assumed to have already been normalized. This is an - * internal API, not a public one. Use toUrl for the public API. - */ - nameToUrl: function (moduleName, ext, skipExt) { - var paths, syms, i, parentModule, url, - parentPath, bundleId, - pkgMain = getOwn(config.pkgs, moduleName); - - if (pkgMain) { - moduleName = pkgMain; - } - - bundleId = getOwn(bundlesMap, moduleName); - - if (bundleId) { - return context.nameToUrl(bundleId, ext, skipExt); - } - - //If a colon is in the URL, it indicates a protocol is used and it is just - //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?) - //or ends with .js, then assume the user meant to use an url and not a module id. - //The slash is important for protocol-less URLs as well as full paths. - if (req.jsExtRegExp.test(moduleName)) { - //Just a plain path, not module name lookup, so just return it. - //Add extension if it is included. This is a bit wonky, only non-.js things pass - //an extension, this method probably needs to be reworked. - url = moduleName + (ext || ''); - } else { - //A module that needs to be converted to a path. - paths = config.paths; - - syms = moduleName.split('/'); - //For each module name segment, see if there is a path - //registered for it. Start with most specific name - //and work up from it. - for (i = syms.length; i > 0; i -= 1) { - parentModule = syms.slice(0, i).join('/'); - - parentPath = getOwn(paths, parentModule); - if (parentPath) { - //If an array, it means there are a few choices, - //Choose the one that is desired - if (isArray(parentPath)) { - parentPath = parentPath[0]; - } - syms.splice(0, i, parentPath); - break; - } - } - - //Join the path parts together, then figure out if baseUrl is needed. - url = syms.join('/'); - url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js')); - url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url; - } - - return config.urlArgs ? url + - ((url.indexOf('?') === -1 ? '?' : '&') + - config.urlArgs) : url; - }, - - //Delegates to req.load. Broken out as a separate function to - //allow overriding in the optimizer. - load: function (id, url) { - req.load(context, id, url); - }, - - /** - * Executes a module callback function. Broken out as a separate function - * solely to allow the build system to sequence the files in the built - * layer in the right sequence. - * - * @private - */ - execCb: function (name, callback, args, exports) { - return callback.apply(exports, args); - }, - - /** - * callback for script loads, used to check status of loading. - * - * @param {Event} evt the event from the browser for the script - * that was loaded. - */ - onScriptLoad: function (evt) { - //Using currentTarget instead of target for Firefox 2.0's sake. Not - //all old browsers will be supported, but this one was easy enough - //to support and still makes sense. - if (evt.type === 'load' || - (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) { - //Reset interactive script so a script node is not held onto for - //to long. - interactiveScript = null; - - //Pull out the name of the module and the context. - var data = getScriptData(evt); - context.completeLoad(data.id); - } - }, - - /** - * Callback for script errors. - */ - onScriptError: function (evt) { - var data = getScriptData(evt); - if (!hasPathFallback(data.id)) { - return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id])); - } - } - }; - - context.require = context.makeRequire(); - return context; - } - - /** - * Main entry point. - * - * If the only argument to require is a string, then the module that - * is represented by that string is fetched for the appropriate context. - * - * If the first argument is an array, then it will be treated as an array - * of dependency string names to fetch. An optional function callback can - * be specified to execute when all of those dependencies are available. - * - * Make a local req variable to help Caja compliance (it assumes things - * on a require that are not standardized), and to give a short - * name for minification/local scope use. - */ - req = requirejs = function (deps, callback, errback, optional) { - - //Find the right context, use default - var context, config, - contextName = defContextName; - - // Determine if have config object in the call. - if (!isArray(deps) && typeof deps !== 'string') { - // deps is a config object - config = deps; - if (isArray(callback)) { - // Adjust args if there are dependencies - deps = callback; - callback = errback; - errback = optional; - } else { - deps = []; - } - } - - if (config && config.context) { - contextName = config.context; - } - - context = getOwn(contexts, contextName); - if (!context) { - context = contexts[contextName] = req.s.newContext(contextName); - } - - if (config) { - context.configure(config); - } - - return context.require(deps, callback, errback); - }; - - /** - * Support require.config() to make it easier to cooperate with other - * AMD loaders on globally agreed names. - */ - req.config = function (config) { - return req(config); - }; - - /** - * Execute something after the current tick - * of the event loop. Override for other envs - * that have a better solution than setTimeout. - * @param {Function} fn function to execute later. - */ - req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) { - setTimeout(fn, 4); - } : function (fn) { fn(); }; - - /** - * Export require as a global, but only if it does not already exist. - */ - if (!require) { - require = req; - } - - req.version = version; - - //Used to filter out dependencies that are already paths. - req.jsExtRegExp = /^\/|:|\?|\.js$/; - req.isBrowser = isBrowser; - s = req.s = { - contexts: contexts, - newContext: newContext - }; - - //Create default context. - req({}); - - //Exports some context-sensitive methods on global require. - each([ - 'toUrl', - 'undef', - 'defined', - 'specified' - ], function (prop) { - //Reference from contexts instead of early binding to default context, - //so that during builds, the latest instance of the default context - //with its config gets used. - req[prop] = function () { - var ctx = contexts[defContextName]; - return ctx.require[prop].apply(ctx, arguments); - }; - }); - - if (isBrowser) { - head = s.head = document.getElementsByTagName('head')[0]; - //If BASE tag is in play, using appendChild is a problem for IE6. - //When that browser dies, this can be removed. Details in this jQuery bug: - //http://dev.jquery.com/ticket/2709 - baseElement = document.getElementsByTagName('base')[0]; - if (baseElement) { - head = s.head = baseElement.parentNode; - } - } - - /** - * Any errors that require explicitly generates will be passed to this - * function. Intercept/override it if you want custom error handling. - * @param {Error} err the error object. - */ - req.onError = defaultOnError; - - /** - * Creates the node for the load command. Only used in browser envs. - */ - req.createNode = function (config, moduleName, url) { - var node = config.xhtml ? - document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') : - document.createElement('script'); - node.type = config.scriptType || 'text/javascript'; - node.charset = 'utf-8'; - node.async = true; - return node; - }; - - /** - * Does the request to load a module for the browser case. - * Make this a separate function to allow other environments - * to override it. - * - * @param {Object} context the require context to find state. - * @param {String} moduleName the name of the module. - * @param {Object} url the URL to the module. - */ - req.load = function (context, moduleName, url) { - var config = (context && context.config) || {}, - node; - if (isBrowser) { - //In the browser so use a script tag - node = req.createNode(config, moduleName, url); - - node.setAttribute('data-requirecontext', context.contextName); - node.setAttribute('data-requiremodule', moduleName); - - //Set up load listener. Test attachEvent first because IE9 has - //a subtle issue in its addEventListener and script onload firings - //that do not match the behavior of all other browsers with - //addEventListener support, which fire the onload event for a - //script right after the script execution. See: - //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution - //UNFORTUNATELY Opera implements attachEvent but does not follow the script - //script execution mode. - if (node.attachEvent && - //Check if node.attachEvent is artificially added by custom script or - //natively supported by browser - //read https://github.com/jrburke/requirejs/issues/187 - //if we can NOT find [native code] then it must NOT natively supported. - //in IE8, node.attachEvent does not have toString() - //Note the test for "[native code" with no closing brace, see: - //https://github.com/jrburke/requirejs/issues/273 - !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) && - !isOpera) { - //Probably IE. IE (at least 6-8) do not fire - //script onload right after executing the script, so - //we cannot tie the anonymous define call to a name. - //However, IE reports the script as being in 'interactive' - //readyState at the time of the define call. - useInteractive = true; - - node.attachEvent('onreadystatechange', context.onScriptLoad); - //It would be great to add an error handler here to catch - //404s in IE9+. However, onreadystatechange will fire before - //the error handler, so that does not help. If addEventListener - //is used, then IE will fire error before load, but we cannot - //use that pathway given the connect.microsoft.com issue - //mentioned above about not doing the 'script execute, - //then fire the script load event listener before execute - //next script' that other browsers do. - //Best hope: IE10 fixes the issues, - //and then destroys all installs of IE 6-9. - //node.attachEvent('onerror', context.onScriptError); - } else { - node.addEventListener('load', context.onScriptLoad, false); - node.addEventListener('error', context.onScriptError, false); - } - node.src = url; - - //For some cache cases in IE 6-8, the script executes before the end - //of the appendChild execution, so to tie an anonymous define - //call to the module name (which is stored on the node), hold on - //to a reference to this node, but clear after the DOM insertion. - currentlyAddingScript = node; - if (baseElement) { - head.insertBefore(node, baseElement); - } else { - head.appendChild(node); - } - currentlyAddingScript = null; - - return node; - } else if (isWebWorker) { - try { - //In a web worker, use importScripts. This is not a very - //efficient use of importScripts, importScripts will block until - //its script is downloaded and evaluated. However, if web workers - //are in play, the expectation that a build has been done so that - //only one script needs to be loaded anyway. This may need to be - //reevaluated if other use cases become common. - importScripts(url); - - //Account for anonymous modules - context.completeLoad(moduleName); - } catch (e) { - context.onError(makeError('importscripts', - 'importScripts failed for ' + - moduleName + ' at ' + url, - e, - [moduleName])); - } - } - }; - - function getInteractiveScript() { - if (interactiveScript && interactiveScript.readyState === 'interactive') { - return interactiveScript; - } - - eachReverse(scripts(), function (script) { - if (script.readyState === 'interactive') { - return (interactiveScript = script); - } - }); - return interactiveScript; - } - - //Look for a data-main script attribute, which could also adjust the baseUrl. - if (isBrowser && !cfg.skipDataMain) { - //Figure out baseUrl. Get it from the script tag with require.js in it. - eachReverse(scripts(), function (script) { - //Set the 'head' where we can append children by - //using the script's parent. - if (!head) { - head = script.parentNode; - } - - //Look for a data-main attribute to set main script for the page - //to load. If it is there, the path to data main becomes the - //baseUrl, if it is not already set. - dataMain = script.getAttribute('data-main'); - if (dataMain) { - //Preserve dataMain in case it is a path (i.e. contains '?') - mainScript = dataMain; - - //Set final baseUrl if there is not already an explicit one. - if (!cfg.baseUrl) { - //Pull off the directory of data-main for use as the - //baseUrl. - src = mainScript.split('/'); - mainScript = src.pop(); - subPath = src.length ? src.join('/') + '/' : './'; - - cfg.baseUrl = subPath; - } - - //Strip off any trailing .js since mainScript is now - //like a module name. - mainScript = mainScript.replace(jsSuffixRegExp, ''); - - //If mainScript is still a path, fall back to dataMain - if (req.jsExtRegExp.test(mainScript)) { - mainScript = dataMain; - } - - //Put the data-main script in the files to load. - cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript]; - - return true; - } - }); - } - - /** - * The function that handles definitions of modules. Differs from - * require() in that a string for the module should be the first argument, - * and the function to execute after dependencies are loaded should - * return a value to define the module corresponding to the first argument's - * name. - */ - define = function (name, deps, callback) { - var node, context; - - //Allow for anonymous modules - if (typeof name !== 'string') { - //Adjust args appropriately - callback = deps; - deps = name; - name = null; - } - - //This module may not have dependencies - if (!isArray(deps)) { - callback = deps; - deps = null; - } - - //If no name, and callback is a function, then figure out if it a - //CommonJS thing with dependencies. - if (!deps && isFunction(callback)) { - deps = []; - //Remove comments from the callback string, - //look for require calls, and pull them into the dependencies, - //but only if there are function args. - if (callback.length) { - callback - .toString() - .replace(commentRegExp, '') - .replace(cjsRequireRegExp, function (match, dep) { - deps.push(dep); - }); - - //May be a CommonJS thing even without require calls, but still - //could use exports, and module. Avoid doing exports and module - //work though if it just needs require. - //REQUIRES the function to expect the CommonJS variables in the - //order listed below. - deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps); - } - } - - //If in IE 6-8 and hit an anonymous define() call, do the interactive - //work. - if (useInteractive) { - node = currentlyAddingScript || getInteractiveScript(); - if (node) { - if (!name) { - name = node.getAttribute('data-requiremodule'); - } - context = contexts[node.getAttribute('data-requirecontext')]; - } - } - - //Always save off evaluating the def call until the script onload handler. - //This allows multiple modules to be in a file without prematurely - //tracing dependencies, and allows for anonymous module support, - //where the module name is not known until the script onload event - //occurs. If no context, use the global queue, and get it processed - //in the onscript load callback. - (context ? context.defQueue : globalDefQueue).push([name, deps, callback]); - }; - - define.amd = { - jQuery: true - }; - - - /** - * Executes the text. Normally just uses eval, but can be modified - * to use a better, environment-specific call. Only used for transpiling - * loader plugins, not for plain JS modules. - * @param {String} text the text to execute/evaluate. - */ - req.exec = function (text) { - /*jslint evil: true */ - return eval(text); - }; - - //Set up with config info. - req(cfg); -}(this)); diff --git a/dist/modules/loader.js b/dist/modules/loader.js deleted file mode 100644 index d7e78eac..00000000 --- a/dist/modules/loader.js +++ /dev/null @@ -1,87 +0,0 @@ -define(['../dom', '../types'], function (dom, types) { - 'use strict'; -console.log(arguments); - - var global = window; - - function Loader(tf){ - - // Original configuration - var f = tf.fObj; - //id of container element - tf.loaderTgtId = f.loader_target_id || null; - //div containing loader - tf.loaderDiv = null; - //defines loader text - tf.loaderText = f.loader_text || 'Loading...'; - //defines loader innerHtml - tf.loaderHtml = f.loader_html || null; - //defines css class for loader div - tf.loaderCssClass = f.loader_css_class || 'loader'; - //delay for hiding loader - tf.loaderCloseDelay = 200; - //callback function before loader is displayed - tf.onShowLoader = types.isFn(f.on_show_loader) ? - f.on_show_loader : null; - //callback function after loader is closed - tf.onHideLoader = types.isFn(f.on_hide_loader) ? - f.on_hide_loader : null; - - this.tf = tf; - - var containerDiv = dom.create('div',['id', tf.prfxLoader+tf.id]); - containerDiv.className = tf.loaderCssClass; - - var targetEl = !tf.loaderTgtId ? - (tf.gridLayout ? tf.tblCont : tf.tbl.parentNode) : - TF.id(tf.loaderTgtId); - if(!tf.loaderTgtId){ - targetEl.insertBefore(containerDiv, tf.tbl); - } else { - targetEl.appendChild(containerDiv); - } - tf.loaderDiv = TF.id(tf.prfxLoader+tf.id); - if(!tf.loaderHtml){ - tf.loaderDiv.appendChild(dom.text(tf.loaderText)); - } else { - tf.loaderDiv.innerHTML = tf.loaderHtml; - } - } - - Loader.prototype.show = function(p) { - if(!this.tf.loader || !this.tf.loaderDiv || - this.tf.loaderDiv.style.display===p){ - return; - } - var o = this.tf; - - function displayLoader(){ - if(!o.loaderDiv){ - return; - } - if(o.onShowLoader && p!=='none'){ - o.onShowLoader.call(null, o); - } - o.loaderDiv.style.display = p; - if(o.onHideLoader && p==='none'){ - o.onHideLoader.call(null, o); - } - } - - var t = p==='none' ? this.tf.loaderCloseDelay : 1; - global.setTimeout(displayLoader, t); - }; - - Loader.prototype.remove = function() { - if(!this.tf.loaderDiv){ - return; - } - var targetEl = !this.tf.loaderTgtId ? - (this.tf.gridLayout ? this.tf.tblCont : this.tf.tbl.parentNode) : - TF.id(this.tf.loaderTgtId); - targetEl.removeChild(this.tf.loaderDiv); - this.tf.loaderDiv = null; - }; - - return Loader; -}); \ No newline at end of file diff --git a/dist/src/modules/loader.js b/dist/src/modules/loader.js deleted file mode 100644 index d5b28daf..00000000 --- a/dist/src/modules/loader.js +++ /dev/null @@ -1,7 +0,0 @@ -define(['../core'], function (require) { - 'use strict'; - - function Loader(){} - - return Loader; -}); \ No newline at end of file diff --git a/dist/string.js b/dist/string.js deleted file mode 100644 index ff0bface..00000000 --- a/dist/string.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * String utilities - */ - -define(function () { - 'use strict'; - - var Str = {}; - - Str.lower = function(text){ - return text.toLowerCase(); - }; - - Str.upper = function(text){ - return text.toUpperCase(); - }; - - Str.trim = function(text){ - if (text.trim){ - return text.trim(); - } - return text.replace(/^\s*|\s*$/g, ''); - }; - - Str.isEmpty = function(text){ - return this.trim(text) === ''; - }; - - Str.rgxEsc = function(text){ - function escape(e){ - var a = new RegExp('\\'+e,'g'); - text = text.replace(a,'\\'+e); - } - - var chars = ['\\','[','^','$','.','|','?','*','+','(',')']; - for(var e=0; e0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||q)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function d(b,c){return function(){var d=s.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),k.apply(a,d.concat([b,c]))}}function e(a){return function(b){return c(b,a)}}function f(a){return function(b){n[a]=b}}function g(c){if(b(o,c)){var d=o[c];delete o[c],q[c]=!0,j.apply(a,d)}if(!b(n,c)&&!b(q,c))throw new Error("No "+c);return n[c]}function h(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function i(a){return function(){return p&&p.config&&p.config[a]||{}}}var j,k,l,m,n={},o={},p={},q={},r=Object.prototype.hasOwnProperty,s=[].slice,t=/\.js$/;l=function(a,b){var d,f=h(a),i=f[0];return a=f[1],i&&(i=c(i,b),d=g(i)),i?a=d&&d.normalize?d.normalize(a,e(b)):c(a,b):(a=c(a,b),f=h(a),i=f[0],a=f[1],i&&(d=g(i))),{f:i?i+"!"+a:a,n:a,pr:i,p:d}},m={require:function(a){return d(a)},exports:function(a){var b=n[a];return"undefined"!=typeof b?b:n[a]={}},module:function(a){return{id:a,uri:"",exports:n[a],config:i(a)}}},j=function(c,e,h,i){var j,k,p,r,s,t,u=[],v=typeof h;if(i=i||c,"undefined"===v||"function"===v){for(e=!e.length&&h.length?["require","exports","module"]:e,s=0;s]+>/g,"");return b=b.replace(/^\s+/,"").replace(/\s+$/,"")},b.create=function(a){if(a&&""!==a){var b=document.createElement(a),c=arguments;if(c.length>1)for(var d=0;d0){var d=document.cookie,e=d.indexOf(c);if(-1!==e){e+=c.length;var f=d.indexOf(";",e);-1===f&&(f=d.length),b=unescape(d.substring(e,f))}}return b},a.remove=function(a){this.write(a,"",-1)},a.valueToArray=function(a,b){b||(b=",");var c=this.read(a),d=c.split(b);return d},a.getValueByIndex=function(a,b,c){c||(c=",");var d=this.valueToArray(a,c);return d[b]},a}),define("types",[],function(){var a={},b=void 0;return a.isObj=function(a){var b=!1;return"string"==typeof a?window[a]&&"object"==typeof window[a]&&(b=!0):a&&"object"==typeof a&&(b=!0),b},a.isFn=function(a){return a&&a.constructor==Function},a.isArray=function(a){return a&&a.constructor==Array},a.isUndef=function(a){return a===b},a}),define("array",["require","./string"],function(a){var b=a("./string"),c={has:function(a,c,d){for(var e=void 0===d?!1:d,f=0;f2)return a;var b;return 99>=a&&a>50&&(b="19"+a),(50>a||"00"===a)&&(b="20"+a),b}function d(a){if(void 0===a)return 0;for(var b,c=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],d=0;d11||23>b)&&(b-=12),1>b||b>12?0:b}if(b||(b="DMY"),!a||""===a)return new Date(1001,0,1);var e,f;switch(b.toUpperCase()){case"DDMMMYYYY":f=a.replace(/[- \/.]/g," ").split(" "),e=new Date(c(f[2]),d(f[1])-1,f[0]);break;case"DMY":f=a.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),e=new Date(c(f[2]),f[1]-1,f[0]);break;case"MDY":f=a.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),e=new Date(c(f[2]),f[0]-1,f[1]);break;case"YMD":f=a.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),e=new Date(c(f[0]),f[1]-1,f[2]);break;default:f=a.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),e=new Date(c(f[2]),f[1]-1,f[0])}return e}};return a}),define("modules/loader",["../dom","../types"],function(a,b){function c(c){var d=c.fObj;c.loaderTgtId=d.loader_target_id||null,c.loaderDiv=null,c.loaderText=d.loader_text||"Loading...",c.loaderHtml=d.loader_html||null,c.loaderCssClass=d.loader_css_class||"loader",c.loaderCloseDelay=200,c.onShowLoader=b.isFn(d.on_show_loader)?d.on_show_loader:null,c.onHideLoader=b.isFn(d.on_hide_loader)?d.on_hide_loader:null,this.tf=c;var e=a.create("div",["id",c.prfxLoader+c.id]);e.className=c.loaderCssClass;var f=c.loaderTgtId?a.id(c.loaderTgtId):c.gridLayout?c.tblCont:c.tbl.parentNode;c.loaderTgtId?f.appendChild(e):f.insertBefore(e,c.tbl),c.loaderDiv=a.id(c.prfxLoader+c.id),c.loaderHtml?c.loaderDiv.innerHTML=c.loaderHtml:c.loaderDiv.appendChild(a.text(c.loaderText))}var d=window;return c.prototype.show=function(a){function b(){c.loaderDiv&&(c.onShowLoader&&"none"!==a&&c.onShowLoader.call(null,c),c.loaderDiv.style.display=a,c.onHideLoader&&"none"===a&&c.onHideLoader.call(null,c))}if(this.tf.loader&&this.tf.loaderDiv&&this.tf.loaderDiv.style.display!==a){var c=this.tf,e="none"===a?this.tf.loaderCloseDelay:1;d.setTimeout(b,e)}},c.prototype.remove=function(){if(this.tf.loaderDiv){var b=this.tf.loaderTgtId?a.id(this.tf.loaderTgtId):this.tf.gridLayout?this.tf.tblCont:this.tf.tbl.parentNode;b.removeChild(this.tf.loaderDiv),this.tf.loaderDiv=null}},c}),define("core",["require","event","dom","string","cookie","types","array","helpers","date","date","modules/loader"],function(require){function TableFilter(a){if(0!==arguments.length){if(this.id=a,this.version="3.0",this.year=(new Date).getFullYear(),this.tbl=dom.id(a),this.startRow=null,this.refRow=null,this.headersRow=null,this.fObj=null,this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this.hasGrid=!1,this.enableModules=!1,!this.tbl||"table"!==str.lower(this.tbl.nodeName)||0===this.GetRowsNb())throw new Error("Could not instantiate TF object: table not found.");if(arguments.length>1)for(var b=0;b1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==e.filters_cell_tag||"td"!==e.filters_cell_tag?"td":e.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.tblData=[],this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.contDiv=null,this.infDivCssClass=e.inf_div_css_class||"inf",this.lDivCssClass=e.left_div_css_class||"ldiv",this.rDivCssClass=e.right_div_css_class||"rdiv",this.mDivCssClass=e.middle_div_css_class||"mdiv",this.contDivCssClass=e.content_div_css_class||"cont",this.stylesheet=e.stylesheet||this.basePath+"filtergrid.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=e.flts_row_css_class||"fltrow",this.enableIcons=e.enable_icons===!1?!1:!0,this.alternateBgs=e.alternate_rows===!0?!0:!1,this.hasColWidth=e.col_width===!0?!0:!1,this.colWidth=this.hasColWidth?e.col_width:null,this.fixedHeaders=e.fixed_headers===!0?!0:!1,this.tBodyH=isNaN(e.tbody_height)?200:e.tbody_height,this.fltCssClass=e.flt_css_class||"flt",this.fltMultiCssClass=e.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=e.flt_small_css_class||"flt_s",this.singleFltCssClass=e.single_flt_css_class||"single_flt",this.isStartBgAlternate=!0,this.rowBgEvenCssClass=e.even_row_css_class||"even",this.rowBgOddCssClass=e.odd_row_css_class||"odd",this.enterKey=e.enter_key===!1?!1:!0,this.isModFilterFn=e.mod_filter_fn===!0?!0:!1,this.modFilterFn=this.isModFilterFn?e.mod_filter_fn:null,this.onBeforeFilter=types.isFn(e.on_before_filter)?e.on_before_filter:null,this.onAfterFilter=types.isFn(e.on_after_filter)?e.on_after_filter:null,this.matchCase=e.match_case===!0?!0:!1,this.exactMatch=e.exact_match===!0?!0:!1,this.refreshFilters=e.refresh_filters===!0?!0:!1,this.disableExcludedOptions=e.disable_excluded_options===!0?!0:!1,this.activeFlt=null,this.activeFilterId=null,this.hasColOperation=e.col_operation===!0?!0:!1,this.colOperation=null,this.hasVisibleRows=e.rows_always_visible===!0?!0:!1,this.visibleRows=this.hasVisibleRows?e.rows_always_visible:[],this.searchType=e.search_type||"include",this.isExternalFlt=e.external_flt_grid===!0?!0:!1,this.externalFltTgtIds=e.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(e.exec_delay)?100:parseInt(e.exec_delay,10),this.status=e.status===!0?!0:!1,this.onFiltersLoaded=types.isFn(e.on_filters_loaded)?e.on_filters_loaded:null,this.singleSearchFlt=e.single_search_filter===!0?!0:!1,this.onRowValidated=types.isFn(e.on_row_validated)?e.on_row_validated:null,this.customCellDataCols=e.custom_cell_data_cols?e.custom_cell_data_cols:[],this.customCellData=types.isFn(e.custom_cell_data)?e.custom_cell_data:null,this.inpWatermark=e.input_watermark||"",this.inpWatermarkCssClass=e.input_watermark_css_class||"fltWatermark",this.isInpWatermarkArray=types.isArray(e.input_watermark),this.toolBarTgtId=e.toolbar_target_id||null,this.helpInstructions=e.help_instructions||null,this.popUpFilters=e.popup_filters===!0?!0:!1,this.markActiveColumns=e.mark_active_columns===!0?!0:!1,this.activeColumnsCssClass=e.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=types.isFn(e.on_before_active_column)?e.on_before_active_column:null,this.onAfterActiveColumn=types.isFn(e.on_after_active_column)?e.on_after_active_column:null,this.displayAllText=e.display_all_text||"",this.enableSlcResetFilter=e.enable_slc_reset_filter===!1?!1:!0,this.enableEmptyOption=e.enable_empty_option===!0?!0:!1,this.emptyText=e.empty_text||"(Empty)",this.enableNonEmptyOption=e.enable_non_empty_option===!0?!0:!1,this.nonEmptyText=e.non_empty_text||"(Non empty)",this.onSlcChange=e.on_change===!1?!1:!0,this.sortSlc=e.sort_select===!1?!1:!0,this.isSortNumAsc=e.sort_num_asc===!0?!0:!1,this.sortNumAsc=this.isSortNumAsc?e.sort_num_asc:null,this.isSortNumDesc=e.sort_num_desc===!0?!0:!1,this.sortNumDesc=this.isSortNumDesc?e.sort_num_desc:null,this.slcFillingMethod=e.slc_filling_method||"createElement",this.fillSlcOnDemand=e.fill_slc_on_demand===!0?!0:!1,this.activateSlcTooltip=e.activate_slc_tooltip||"Click to activate",this.multipleSlcTooltip=e.multiple_slc_tooltip||"Use Ctrl key for multiple selections",this.hasCustomSlcOptions=types.isObj(e.custom_slc_options)?!0:!1,this.customSlcOptions=types.isArray(e.custom_slc_options)?e.custom_slc_options:null,this.onBeforeOperation=types.isFn(e.on_before_operation)?e.on_before_operation:null,this.onAfterOperation=types.isFn(e.on_after_operation)?e.on_after_operation:null,this.checkListDiv=[],this.checkListDivCssClass=e.div_checklist_css_class||"div_checklist",this.checkListCssClass=e.checklist_css_class||"flt_checklist",this.checkListItemCssClass=e.checklist_item_css_class||"flt_checklist_item",this.checkListSlcItemCssClass=e.checklist_selected_item_css_class||"flt_checklist_slc_item",this.activateCheckListTxt=e.activate_checklist_text||"Click to load filter data",this.checkListItemDisabledCssClass=e.checklist_item_disabled_css_class||"flt_checklist_item_disabled",this.enableCheckListResetFilter=e.enable_checklist_reset_filter===!1?!1:!0,this.rgxOperator=e.regexp_operator||"rgx:",this.emOperator=e.empty_operator||"[empty]",this.nmOperator=e.nonempty_operator||"[nonempty]",this.orOperator=e.or_operator||"||",this.anOperator=e.and_operator||"&&",this.grOperator=e.greater_operator||">",this.lwOperator=e.lower_operator||"<",this.leOperator=e.lower_equal_operator||"<=",this.geOperator=e.greater_equal_operator||">=",this.dfOperator=e.different_operator||"!",this.lkOperator=e.like_operator||"*",this.eqOperator=e.equal_operator||"=",this.stOperator=e.start_with_operator||"{",this.enOperator=e.end_with_operator||"}",this.curExp=e.cur_exp||"^[¥£€$]",this.separator=e.separator||",",this.rowsCounter=e.rows_counter===!0?!0:!1,this.statusBar=e.status_bar===!0?!0:!1,this.loader=e.loader===!0?!0:!1,this.displayBtn=e.btn===!0?!0:!1,this.btnText=e.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=e.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=e.btn_reset===!0?!0:!1,this.btnResetCssClass=e.btn_reset_css_class||"reset",this.onBeforeReset=types.isFn(e.on_before_reset)?e.on_before_reset:null,this.onAfterReset=types.isFn(e.on_after_reset)?e.on_after_reset:null,this.paging=e.paging===!0?!0:!1,this.hasResultsPerPage=e.results_per_page===!0?!0:!1,this.btnPageCssClass=e.paging_btn_css_class||"pgInp",this.pagingSlc=null,this.resultsPerPage=null,this.resultsPerPageSlc=null,this.isPagingRemoved=!1,this.nbVisibleRows=0,this.nbHiddenRows=0,this.startPagingRow=0,this.nbPages=0,this.currentPageNb=1,this.sort=e.sort===!0?!0:!1,this.isSortEnabled=!1,this.sorted=!1,this.sortConfig=e.sort_config||{},this.sortConfig.name=void 0!==this.sortConfig.name?e.sort_config.name:"sortabletable",this.sortConfig.src=void 0!==this.sortConfig.src?e.sort_config.src:this.basePath+"sortabletable.js",this.sortConfig.adapterSrc=void 0!==this.sortConfig.adapter_src?e.sort_config.adapter_src:this.basePath+"tfAdapter.sortabletable.js",this.sortConfig.initialize=void 0!==this.sortConfig.initialize?e.sort_config.initialize:function(a){a.SetSortTable&&a.SetSortTable()},this.sortConfig.sortTypes=types.isArray(this.sortConfig.sort_types)?e.sort_config.sort_types:[],this.sortConfig.sortCol=void 0!==this.sortConfig.sort_col?e.sort_config.sort_col:null,this.sortConfig.asyncSort=this.sortConfig.async_sort===!0?!0:!1,this.sortConfig.triggerIds=types.isArray(this.sortConfig.sort_trigger_ids)?e.sort_config.sort_trigger_ids:[],this.selectable=e.selectable===!0?!0:!1,this.editable=e.editable===!0?!0:!1,this.ezEditTableConfig=e.ezEditTable_config||{},this.ezEditTableConfig.name=void 0!==this.ezEditTableConfig.name?e.ezEditTable_config.name:"ezedittable",this.ezEditTableConfig.src=void 0!==this.ezEditTableConfig.src?e.ezEditTable_config.src:this.basePath+"ezEditTable/ezEditTable.js",this.ezEditTableConfig.loadStylesheet=this.ezEditTableConfig.loadStylesheet===!0?!0:!1,this.ezEditTableConfig.stylesheet=this.ezEditTableConfig.stylesheet||this.basePath+"ezEditTable/ezEditTable.css",this.ezEditTableConfig.stylesheetName=void 0!==this.ezEditTableConfig.stylesheetName?e.ezEditTable_config.stylesheetName:"ezEditTableCss",this.ezEditTableConfig.err='Failed to instantiate EditTable object.\n"ezEditTable" module may not be available.',this.onKeyUp=e.on_keyup===!0?!0:!1,this.onKeyUpDelay=isNaN(e.on_keyup_delay)?900:e.on_keyup_delay,this.isUserTyping=null,this.onKeyUpTimer=void 0,this.highlightKeywords=e.highlight_keywords===!0?!0:!1,this.highlightCssClass=e.highlight_css_class||"keyword",this.highlightedNodes=[],this.defaultDateType=e.default_date_type||"DMY",this.thousandsSeparator=e.thousands_separator||",",this.decimalSeparator=e.decimal_separator||".",this.hasColNbFormat=e.col_number_format===!0?!0:!1,this.colNbFormat=types.isArray(this.hasColNbFormat)?e.col_number_format:null,this.hasColDateType=e.col_date_type===!0?!0:!1,this.colDateType=types.isArray(this.hasColDateType)?e.col_date_type:null,this.msgFilter=e.msg_filter||"Filtering data...",this.msgPopulate=e.msg_populate||"Populating filter...",this.msgPopulateCheckList=e.msg_populate_checklist||"Populating list...",this.msgChangePage=e.msg_change_page||"Collecting paging data...",this.msgClear=e.msg_clear||"Clearing filters...",this.msgChangeResults=e.msg_change_results||"Changing results per page...",this.msgResetValues=e.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=e.msg_reset_page||"Re-setting page...",this.msgResetPageLength=e.msg_reset_page_length||"Re-setting page length...",this.msgSort=e.msg_sort||"Sorting data...",this.msgLoadExtensions=e.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=e.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxContentDiv="cont_",this.prfxCheckListDiv="chkdiv_",this.prfxSlcPages="slcPages_",this.prfxSlcResults="slcResults_",this.prfxSlcResultsTxt="slcResultsTxt_",this.prfxBtnNextSpan="btnNextSpan_",this.prfxBtnPrevSpan="btnPrevSpan_",this.prfxBtnLastSpan="btnLastSpan_",this.prfxBtnFirstSpan="btnFirstSpan_",this.prfxBtnNext="btnNext_",this.prfxBtnPrev="btnPrev_",this.prfxBtnLast="btnLast_",this.prfxBtnFirst="btnFirst_",this.prfxPgSpan="pgspan_",this.prfxPgBeforeSpan="pgbeforespan_",this.prfxPgAfterSpan="pgafterspan_",this.prfxCounter="counter_",this.prfxTotRows="totrows_span_",this.prfxTotRowsTxt="totRowsTextSpan_",this.prfxResetSpan="resetspan_",this.prfxLoader="load_",this.prfxStatus="status_",this.prfxStatusSpan="statusSpan_",this.prfxStatusTxt="statusText_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.prfxMainTblCont="gridCont_",this.prfxTblCont="tblCont_",this.prfxHeadTblCont="tblHeadCont_",this.prfxHeadTbl="tblHead_",this.prfxGridFltTd="_td_",this.prfxGridTh="tblHeadTh_",this.prfxHelpSpan="helpSpan_",this.prfxHelpDiv="helpDiv_",this.prfxPopUpSpan="popUpSpan_",this.prfxPopUpDiv="popUpDiv_",this.hasStoredValues=!1,this.rememberGridValues=e.remember_grid_values===!0?!0:!1,this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&e.remember_page_number?!0:!1,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&e.remember_page_length?!0:!1,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.cookieDuration=isNaN(e.set_cookie_duration)?1e5:parseInt(e.set_cookie_duration,10),this.hasExtensions=e.extensions===!0?!0:!1,this.extensions=this.hasExtensions?e.extensions:null,this.enableDefaultTheme=e.enable_default_theme===!0?!0:!1,this.hasThemes=e.enable_default_theme||e.themes&&types.isObj(e.themes)?!0:!1,this.themes=this.hasThemes?e.themes:null,this.themesPath=e.themes_path||this.basePath+"TF_Themes/",this.loaderCpt=null;var j=this;this.Evt={name:{filter:"Filter",populateselect:"Populate",populatechecklist:"PopulateCheckList",changepage:"ChangePage",clear:"Clear",changeresultsperpage:"ChangeResults",resetvalues:"ResetValues",resetpage:"ResetPage",resetpagelength:"ResetPageLength",sort:"Sort",loadextensions:"LoadExtensions",loadthemes:"LoadThemes"},getKeyCode:function(a){return a.charCode?a.charCode:a.keyCode?a.keyCode:a.which?a.which:0},_DetectKey:function(a){if(j.enterKey){var b=a||global.event;if(b){var c=j.Evt.getKeyCode(b);13===c?(j._Filter(),evt.cancel(b),evt.stop(b)):(j.isUserTyping=!0,global.clearInterval(j.onKeyUpTimer),j.onKeyUpTimer=void 0)}}},_OnKeyUp:function(a){function b(){global.clearInterval(j.onKeyUpTimer),j.onKeyUpTimer=void 0,j.isUserTyping||(j.Filter(),j.isUserTyping=null)}if(j.onKeyUp){var c=a||global.event,d=j.Evt.getKeyCode(c);j.isUserTyping=!1,13!==d&&9!==d&&27!==d&&38!==d&&40!==d?void 0===j.onKeyUpTimer&&(j.onKeyUpTimer=global.setInterval(b,j.onKeyUpDelay)):(global.clearInterval(j.onKeyUpTimer),j.onKeyUpTimer=void 0)}},_OnKeyDown:function(){j.onKeyUp&&(j.isUserTyping=!0)},_OnInpBlur:function(){j.onKeyUp&&(j.isUserTyping=!1,global.clearInterval(j.onKeyUpTimer)),""===this.value&&""!==j.inpWatermark&&(this.value=j.isInpWatermarkArray?j.inpWatermark[this.getAttribute("ct")]:j.inpWatermark,dom.addClass(this,j.inpWatermarkCssClass)),j.ezEditTable&&(j.editable&&j.ezEditTable.Editable.Set(),j.selectable&&j.ezEditTable.Selection.Set())},_OnInpFocus:function(a){var b=a||global.event;if(j.activeFilterId=this.getAttribute("id"),j.activeFlt=dom.id(j.activeFilterId),j.isInpWatermarkArray){var c=j.inpWatermark[this.getAttribute("ct")];this.value===c&&""!==c&&(this.value="",dom.removeClass(this,j.inpWatermarkCssClass))}else this.value===j.inpWatermark&&""!==j.inpWatermark&&(this.value="",dom.removeClass(this,j.inpWatermarkCssClass));j.popUpFilters&&(evt.cancel(b),evt.stop(b)),j.ezEditTable&&(j.editable&&j.ezEditTable.Editable.Remove(),j.selectable&&j.ezEditTable.Selection.Remove())},_OnSlcFocus:function(a){var b=a||global.event;if(j.activeFilterId=this.getAttribute("id"),j.activeFlt=dom.id(j.activeFilterId),j.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var c=this.getAttribute("ct");j.PopulateSelect(c),hlp.isIE()||this.setAttribute("filled","1")}j.popUpFilters&&(evt.cancel(b),evt.stop(b))},_OnSlcChange:function(a){var b=j.activeFlt.getAttribute("colIndex");if(!j.activeFlt||!b||j["col"+b]!==j.fltTypeCheckList||j.Evt._OnSlcChange.caller){var c=a||global.event;j.popUpFilters&&evt.stop(c),j.onSlcChange&&j.Filter()}},_OnSlcBlur:function(){},_OnCheckListChange:function(a){j.Evt._OnCheckListChange.caller&&j.Evt._OnSlcChange(a)},_OnCheckListClick:function(){if(j.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var a=this.getAttribute("ct");j.PopulateCheckList(a),j.checkListDiv[a].onclick=null,j.checkListDiv[a].title=""}},_OnCheckListFocus:function(){j.activeFilterId=this.firstChild.getAttribute("id"),j.activeFlt=dom.id(j.activeFilterId)},_OnCheckListBlur:function(){},_OnBtnClick:function(){j.Filter()},_OnSlcPagesChangeEvt:null,_EnableSlc:function(){this.firstChild.disabled=!1,this.firstChild.focus(),this.onclick=null},_Clear:function(){j.ClearFilters()},_OnHelpBtnClick:function(){j._ToggleHelp()},_Paging:{nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null}}}}function numSortAsc(a,b){return a-b}function numSortDesc(a,b){return b-a}function ignoreCaseSort(a,b){var c=str.lower(a),d=str.lower(b);return d>c?-1:c>d?1:0}function removeNbFormat(a,b){if(a){b||(b="us");var c=a;return c="us"===str.lower(b)?+c.replace(/[^\d\.-]/g,""):+c.replace(/[^\d\,-]/g,"").replace(",",".")}}function isImported(a,b){for(var c=!1,d=b?b:"script",e="script"==d?"src":"href",f=dom.tag(doc,d),g=0;g0?f[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popUpFilters&&this.headersRow++,this.popUpFilters&&this.headersRow++,this.fixedHeaders&&this.SetFixedHeaders(),e.className=this.fltsRowCssClass,this.isExternalFlt&&(!this.gridLayout||this.popUpFilters)&&(e.style.display="none")}this.nbFilterableRows=this.GetRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var g=0;c>g;g++){var h=dom.create(this.fltCellTag),i=this["col"+g],j=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[g]:null;if(this.singleSearchFlt&&(h.colSpan=this.nbCells),this.gridLayout||e.appendChild(h),a=g==c-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,this.popUpFilters&&this.SetPopupFilter(g),void 0===i&&(i=void 0===b["col_"+g]?this.fltTypeInp:str.lower(b["col_"+g])),this.singleSearchFlt&&(i=this.fltTypeInp,a=this.singleFltCssClass),i===this.fltTypeSlc||i===this.fltTypeMulti){var k=dom.create(this.fltTypeSlc,["id",this.prfxFlt+g+"_"+this.id],["ct",g],["filled","0"]);if(i===this.fltTypeMulti&&(k.multiple=this.fltTypeMulti,k.title=this.multipleSlcTooltip),k.className=str.lower(i)===this.fltTypeSlc?a:this.fltMultiCssClass,j?(dom.id(j).appendChild(k),this.externalFltEls.push(k)):h.appendChild(k),this.fltIds.push(this.prfxFlt+g+"_"+this.id),this.fillSlcOnDemand||this._PopulateSelect(g),k.onkeypress=this.Evt._DetectKey,k.onchange=this.Evt._OnSlcChange,k.onfocus=this.Evt._OnSlcFocus,k.onblur=this.Evt._OnSlcBlur,this.fillSlcOnDemand){var l=dom.createOpt(this.displayAllText,"");k.appendChild(l)}this.fillSlcOnDemand&&hlp.isIE()&&(k.disabled=!0,k.title=this.activateSlcTooltip,k.parentNode.onclick=this.Evt._EnableSlc,i===this.fltTypeMulti&&this.__deferMultipleSelection(k,0))}else if(i===this.fltTypeCheckList){var m=dom.create("div",["id",this.prfxCheckListDiv+g+"_"+this.id],["ct",g],["filled","0"]);m.className=this.checkListDivCssClass,j?(dom.id(j).appendChild(m),this.externalFltEls.push(m)):h.appendChild(m),this.checkListDiv[g]=m,this.fltIds.push(this.prfxFlt+g+"_"+this.id),this.fillSlcOnDemand||this._PopulateCheckList(g),m.onclick=this.Evt._OnCheckListFocus,this.fillSlcOnDemand&&(m.onclick=this.Evt._OnCheckListClick,m.appendChild(dom.text(this.activateCheckListTxt))) +}else{var n=i===this.fltTypeInp?"text":"hidden",o=dom.create(this.fltTypeInp,["id",this.prfxFlt+g+"_"+this.id],["type",n],["ct",g]);if("hidden"!=n&&(o.value=this.isInpWatermarkArray?this.inpWatermark[g]:this.inpWatermark),o.className=a,""!==this.inpWatermark&&dom.addClass(o,this.inpWatermarkCssClass),o.onfocus=this.Evt._OnInpFocus,j?(dom.id(j).appendChild(o),this.externalFltEls.push(o)):h.appendChild(o),this.fltIds.push(this.prfxFlt+g+"_"+this.id),o.onkeypress=this.Evt._DetectKey,o.onkeydown=this.Evt._OnKeyDown,o.onkeyup=this.Evt._OnKeyUp,o.onblur=this.Evt._OnInpBlur,this.rememberGridValues){var p=cookie.read(this.fltsValuesCookie),q=new RegExp(this.separator,"g"),r=p.split(q);" "!=r[g]&&this.SetFilterValue(g,r[g],!1)}}if(g==c-1&&this.displayBtn){var s=dom.create(this.fltTypeInp,["id",this.prfxValButton+g+"_"+this.id],["type","button"],["value",this.btnText]);s.className=this.btnCssClass,j?dom.id(j).appendChild(s):h.appendChild(s),s.onclick=this.Evt._OnBtnClick}}}else this.__resetGrid();else this.refRow=this.refRow-1,this.gridLayout&&(this.refRow=0),this.nbFilterableRows=this.GetRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow;this.rowsCounter&&this.SetRowsCounter(),this.statusBar&&this.SetStatusBar(),this.fixedHeaders&&!this.isFirstLoad&&this.SetFixedHeaders(),this.paging&&this.SetPaging(),this.hasResultsPerPage&&this.paging&&this.SetResultsPerPage(),this.btnReset&&this.SetResetBtn(),this.helpInstructions&&this.SetHelpInstructions(),this.hasColWidth&&!this.gridLayout&&this.SetColWidths(),this.alternateBgs&&this.isStartBgAlternate&&this.SetAlternateRows(),this.hasColOperation&&this.fltGrid&&(this.colOperation=b.col_operation,this.SetColOperation()),(this.sort||this.gridLayout)&&this.SetSort(),(this.selectable||this.editable)&&this.SetEditable(),this.isFirstLoad=!1,this.hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.ResetValues(),this.gridLayout||dom.addClass(this.tbl,this.prfxTf),this.loader&&this.loaderCpt.show("none"),this.hasExtensions&&this.LoadExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this)}},EvtManager:function(a,b){function c(){if(a){switch(a){case d.Evt.name.filter:d.isModFilterFn?d.modFilterFn.call(null,d):d._Filter();break;case d.Evt.name.populateselect:d.refreshFilters?d._PopulateSelect(e,!0):d._PopulateSelect(e,!1,f,g);break;case d.Evt.name.populatechecklist:d._PopulateCheckList(e,f,g);break;case d.Evt.name.changepage:d._ChangePage(h);break;case d.Evt.name.clear:d._ClearFilters(),d._Filter();break;case d.Evt.name.changeresultsperpage:d._ChangeResultsPerPage();break;case d.Evt.name.resetvalues:d._ResetValues(),d._Filter();break;case d.Evt.name.resetpage:d._ResetPage(d.pgNbCookie);break;case d.Evt.name.resetpagelength:d._ResetPageLength(d.pgLenCookie);break;case d.Evt.name.sort:break;case d.Evt.name.loadextensions:d._LoadExtensions();break;case d.Evt.name.loadthemes:d._LoadThemes();break;default:d["_"+a].call(null,d,b)}(d.status||d.statusBar)&&d.StatusMsg(""),d.loader&&d.loaderCpt.show("none")}}var d=this,e=b&&void 0!==b.slcIndex?b.slcIndex:null,f=b&&void 0!==b.slcExternal?b.slcExternal:!1,g=b&&void 0!==b.slcId?b.slcId:null,h=b&&void 0!==b.pgIndex?b.pgIndex:null;if(this.loader||this.status||this.statusBar){try{this.loaderCpt.show(""),this.StatusMsg(d["msg"+a])}catch(i){}global.setTimeout(c,this.execDelay)}else c()},ImportModule:function(a){a.path&&a.name&&this.IncludeFile(a.name,a.path,a.init)},LoadExtensions:function(){if(!this.Ext){var a=this;this.Ext={list:{},add:function(b,c,d,e){var f=d.split("/")[d.split("/").length-1],g=new RegExp(f),h=d.replace(g,"");a.Ext.list[b]={name:b,description:c,file:f,path:h,callback:e}}}}this.EvtManager(this.Evt.name.loadextensions)},_LoadExtensions:function(){if(this.hasExtensions&&types.isArray(this.extensions.name)&&types.isArray(this.extensions.src))for(var a=this.extensions,b=0;b',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},RemoveGrid:function(){if(this.fltGrid&&this.hasGrid){var a=this.tbl.rows;this.paging&&this.RemovePaging(),this.statusBar&&this.RemoveStatusBar(),this.rowsCounter&&this.RemoveRowsCounter(),this.btnReset&&this.RemoveResetBtn(),(this.helpInstructions||!this.helpInstructions)&&this.RemoveHelpInstructions(),this.paging&&this.RemoveResultsPerPage(),this.isExternalFlt&&!this.popUpFilters&&this.RemoveExternalFlts(),this.fixedHeaders&&this.RemoveFixedHeaders(),this.infDiv&&this.RemoveTopDiv(),this.highlightKeywords&&this.UnhighlightAll(),this.sort&&this.RemoveSort(),this.loader&&this.loaderCpt.remove(),this.popUpFilters&&this.RemovePopupFilters(),this.markActiveColumns&&this.ClearActiveColumns(),(this.editable||this.selectable)&&this.RemoveEditable();for(var b=this.refRow;b0&&!c.startRow?void 0:c.startRow||a.refRow,c.scroll_into_view=c.scroll_into_view===!1?!1:!0,c.base_path=c.base_path||a.basePath+"ezEditTable/",c.editable=a.editable=a.fObj.editable,c.selection=a.selectable=a.fObj.selectable,a.selectable&&(c.default_selection=c.default_selection||"row"),c.active_cell_css=c.active_cell_css||"ezETSelectedCell",a._lastValidRowIndex=0,a._lastRowIndex=0,a.selectable){var e=function(b,c,d){if(a.validRowsIndex){var e,f=a.validRowsIndex,g=f.length,h="row"!==b.defaultSelection?c.parentNode:c,i="TD"===c.nodeName?c:null,j=void 0!==d?b.Event.GetKey(d):0,k=array.has(f,h.rowIndex),l=34===j||33===j?a.pagingLength||b.nbRowsPerPage:1;if(k)34!==j&&33!==j?(a._lastValidRowIndex=array.indexByValue(f,h.rowIndex),a._lastRowIndex=h.rowIndex):(e=34===j?a._lastValidRowIndex+l<=g-1?f[a._lastValidRowIndex+l]:[g-1]:a._lastValidRowIndex-l<=f[0]?f[0]:f[a._lastValidRowIndex-l],a._lastRowIndex=e,a._lastValidRowIndex=array.indexByValue(f,e),o(e));else{if(h.rowIndex>a._lastRowIndex)if(h.rowIndex>=f[g-1])e=f[g-1];else{var m=a._lastValidRowIndex+l;e=m>g-1?f[g-1]:f[m]}else if(h.rowIndex<=f[0])e=f[0];else{var n=f[a._lastValidRowIndex-l];e=n?n:f[0]}a._lastRowIndex=h.rowIndex,o(e)}var o=function(d){if("row"===b.defaultSelection)b.Selection.SelectRowByIndex(d);else{b.ClearSelections();var e=c.cellIndex,f=a.tbl.rows[d];"both"===b.defaultSelection&&b.Selection.SelectRowByIndex(d),f&&b.Selection.SelectCell(f.cells[e])}if(a.validRowsIndex.length!==a.GetRowsNb()){var g=a.tbl.rows[d];g&&g.scrollIntoView(!1),i&&(i.cellIndex===a.GetCellsNb()-1&&a.gridLayout?a.tblCont.scrollLeft=1e8:0===i.cellIndex&&a.gridLayout?a.tblCont.scrollLeft=0:i.scrollIntoView(!1))}}}},f=function(b,c){var d="row"!==b.defaultSelection?c.parentNode:c;if(a.paging&&a.nbPages>1){b.nbRowsPerPage=a.pagingLength;var e=a.validRowsIndex,f=e.length,g=parseInt(a.startPagingRow,10)+parseInt(a.pagingLength,10),h=d.rowIndex;h===e[f-1]&&a.currentPageNb!=a.nbPages?a.SetPage("last"):h==e[0]&&1!==a.currentPageNb?a.SetPage("first"):h>e[g-1]&&he[0]&&a.SetPage("previous")}};if(a.paging&&(a.onAfterChangePage=function(a){var b=a.ezEditTable,c=b.Selection.GetActiveRow();c&&c.scrollIntoView(!1);var d=b.Selection.GetActiveCell();d&&d.scrollIntoView(!1)}),"row"===c.default_selection){var g=c.on_before_selected_row;c.on_before_selected_row=function(){f(arguments[0],arguments[1],arguments[2]),g&&g.call(null,arguments[0],arguments[1],arguments[2])};var h=c.on_after_selected_row;c.on_after_selected_row=function(){e(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])}}else{var i=c.on_before_selected_cell;c.on_before_selected_cell=function(){f(arguments[0],arguments[1],arguments[2]),i&&i.call(null,arguments[0],arguments[1],arguments[2])};var j=c.on_after_selected_cell;c.on_after_selected_cell=function(){e(arguments[0],arguments[1],arguments[2]),j&&j.call(null,arguments[0],arguments[1],arguments[2])}}}if(a.editable){var k=c.on_added_dom_row;if(c.on_added_dom_row=function(){a.nbFilterableRows++,a.paging?(a.nbRows++,a.nbVisibleRows++,a.nbFilterableRows++,a.paging=!1,a.RemovePaging(),a.AddPaging(!1)):a.RefreshNbRows(),a.alternateBgs&&a.SetAlternateRows(),k&&k.call(null,arguments[0],arguments[1],arguments[2])},c.actions&&c.actions["delete"]){var l=c.actions["delete"].on_after_submit;c.actions["delete"].on_after_submit=function(){a.nbFilterableRows--,a.paging?(a.nbRows--,a.nbVisibleRows--,a.nbFilterableRows--,a.paging=!1,a.RemovePaging(),a.AddPaging(!1)):a.RefreshNbRows(),a.alternateBgs&&a.SetAlternateRows(),l&&l.call(null,arguments[0],arguments[1])}}}try{a.ezEditTable=new EditTable(a.id,c,b),a.ezEditTable.Init()}catch(m){console.log(c.err)}},SetPaging:function(){if((this.hasGrid||this.isFirstLoad)&&this.paging&&(this.isPagingRemoved||this.isFirstLoad)){var a=this.fObj;this.pagingTgtId=a.paging_target_id||null,this.pagingLength=isNaN(a.paging_length)?10:a.paging_length,this.resultsPerPageTgtId=a.results_per_page_target_id||null,this.pgSlcCssClass=a.paging_slc_css_class||"pgSlc",this.pgInpCssClass=a.paging_inp_css_class||"pgNbInp",this.resultsSlcCssClass=a.results_slc_css_class||"rspg",this.resultsSpanCssClass=a.results_span_css_class||"rspgSpan",this.nbVisibleRows=0,this.nbHiddenRows=0,this.startPagingRow=0,this.nbPages=0,this.btnNextPageText=a.btn_next_page_text||">",this.btnPrevPageText=a.btn_prev_page_text||"<",this.btnLastPageText=a.btn_last_page_text||">|",this.btnFirstPageText=a.btn_first_page_text||"|<",this.btnNextPageHtml=a.btn_next_page_html||(this.enableIcons?'':null),this.btnPrevPageHtml=a.btn_prev_page_html||(this.enableIcons?'':null),this.btnFirstPageHtml=a.btn_first_page_html||(this.enableIcons?'':null),this.btnLastPageHtml=a.btn_last_page_html||(this.enableIcons?'':null),this.pageText=a.page_text||" Page ",this.ofText=a.of_text||" of ",this.nbPgSpanCssClass=a.nb_pages_css_class||"nbpg",this.hasPagingBtns=a.paging_btns===!1?!1:!0,this.pagingBtnEvents=null,this.pageSelectorType=a.page_selector_type||this.fltTypeSlc,this.onBeforeChangePage=types.isFn(a.on_before_change_page)?a.on_before_change_page:null,this.onAfterChangePage=types.isFn(a.on_after_change_page)?a.on_after_change_page:null;var b=this.refRow,c=this.nbRows;if(this.nbPages=Math.ceil((c-b)/this.pagingLength),!this.Evt._Paging.next){var d=this;this.Evt._Paging={slcIndex:function(){return d.pageSelectorType===d.fltTypeSlc?d.pagingSlc.options.selectedIndex:parseInt(d.pagingSlc.value,10)-1},nbOpts:function(){return d.pageSelectorType===d.fltTypeSlc?parseInt(d.pagingSlc.options.length,10)-1:d.nbPages-1},next:function(){d.Evt._Paging.nextEvt&&d.Evt._Paging.nextEvt();var a=d.Evt._Paging.slcIndex()0?d.Evt._Paging.slcIndex()-1:d.Evt._Paging.nbOpts();d.ChangePage(a)},last:function(){d.Evt._Paging.lastEvt&&d.Evt._Paging.lastEvt(),d.ChangePage(d.Evt._Paging.nbOpts())},first:function(){d.Evt._Paging.firstEvt&&d.Evt._Paging.firstEvt(),d.ChangePage(0)},_detectKey:function(a){var b=a||global.event;if(b){var c=d.Evt.getKeyCode(a);13===c&&(d.sorted?(d.Filter(),d.ChangePage(d.Evt._Paging.slcIndex())):d.ChangePage(),this.blur())}},nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null}}this.Evt._OnSlcPagesChange||(this.Evt._OnSlcPagesChange=function(){d.Evt._Paging._OnSlcPagesChangeEvt&&d.Evt._Paging._OnSlcPagesChangeEvt(),d.ChangePage(),this.blur(),this.parentNode&&hlp.isIE()&&this.parentNode.focus()});var e;this.pageSelectorType===this.fltTypeSlc&&(e=dom.create(this.fltTypeSlc,["id",this.prfxSlcPages+this.id]),e.className=this.pgSlcCssClass,e.onchange=this.Evt._OnSlcPagesChange),this.pageSelectorType===this.fltTypeInp&&(e=dom.create(this.fltTypeInp,["id",this.prfxSlcPages+this.id],["value",this.currentPageNb]),e.className=this.pgInpCssClass,e.onkeypress=this.Evt._Paging._detectKey);var f=dom.create("span",["id",this.prfxBtnNextSpan+this.id]),g=dom.create("span",["id",this.prfxBtnPrevSpan+this.id]),h=dom.create("span",["id",this.prfxBtnLastSpan+this.id]),i=dom.create("span",["id",this.prfxBtnFirstSpan+this.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)f.innerHTML=this.btnNextPageHtml,f.onclick=this.Evt._Paging.next;else{var j=dom.create(this.fltTypeInp,["id",this.prfxBtnNext+this.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);j.className=this.btnPageCssClass,j.onclick=this.Evt._Paging.next,f.appendChild(j)}if(this.btnPrevPageHtml)g.innerHTML=this.btnPrevPageHtml,g.onclick=this.Evt._Paging.prev;else{var k=dom.create(this.fltTypeInp,["id",this.prfxBtnPrev+this.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);k.className=this.btnPageCssClass,k.onclick=this.Evt._Paging.prev,g.appendChild(k)}if(this.btnLastPageHtml)h.innerHTML=this.btnLastPageHtml,h.onclick=this.Evt._Paging.last;else{var l=dom.create(this.fltTypeInp,["id",this.prfxBtnLast+this.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);l.className=this.btnPageCssClass,l.onclick=this.Evt._Paging.last,h.appendChild(l)}if(this.btnFirstPageHtml)i.innerHTML=this.btnFirstPageHtml,i.onclick=this.Evt._Paging.first;else{var m=dom.create(this.fltTypeInp,["id",this.prfxBtnFirst+this.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);m.className=this.btnPageCssClass,m.onclick=this.Evt._Paging.first,i.appendChild(m)}}this.pagingTgtId||this.SetTopDiv();var n=this.pagingTgtId?dom.id(this.pagingTgtId):this.mDiv;""!==n.innerHTML&&(n.innerHTML=""),n.appendChild(i),n.appendChild(g);var o=dom.create("span",["id",this.prfxPgBeforeSpan+this.id]);o.appendChild(dom.text(this.pageText)),o.className=this.nbPgSpanCssClass,n.appendChild(o),n.appendChild(e);var p=dom.create("span",["id",this.prfxPgAfterSpan+this.id]);p.appendChild(dom.text(this.ofText)),p.className=this.nbPgSpanCssClass,n.appendChild(p);var q=dom.create("span",["id",this.prfxPgSpan+this.id]);q.className=this.nbPgSpanCssClass,q.appendChild(dom.text(" "+this.nbPages+" ")),n.appendChild(q),n.appendChild(f),n.appendChild(h),this.pagingSlc=dom.id(this.prfxSlcPages+this.id),(!this.rememberGridValues||this.isPagingRemoved)&&this.SetPagingInfo(),this.fltGrid||(this.ValidateAllRows(),this.SetPagingInfo(this.validRowsIndex)),this.pagingBtnEvents=this.Evt._Paging,this.isPagingRemoved=!1}},RemovePaging:function(){if(this.hasGrid&&this.pagingSlc){var a,b,c,d,e,f,g;a=dom.id(this.prfxBtnNextSpan+this.id),b=dom.id(this.prfxBtnPrevSpan+this.id),c=dom.id(this.prfxBtnLastSpan+this.id),d=dom.id(this.prfxBtnFirstSpan+this.id),e=dom.id(this.prfxPgBeforeSpan+this.id),f=dom.id(this.prfxPgAfterSpan+this.id),g=dom.id(this.prfxPgSpan+this.id),this.pagingSlc.parentNode.removeChild(this.pagingSlc),a&&a.parentNode.removeChild(a),b&&b.parentNode.removeChild(b),c&&c.parentNode.removeChild(c),d&&d.parentNode.removeChild(d),e&&e.parentNode.removeChild(e),f&&f.parentNode.removeChild(f),g&&g.parentNode.removeChild(g),this.pagingBtnEvents=null,this.pagingSlc=null,this.isPagingRemoved=!0}},SetPagingInfo:function(a){var b=this.tbl.rows,c=this.pagingTgtId?dom.id(this.pagingTgtId):this.mDiv,d=dom.id(this.prfxPgSpan+this.id);if(a&&a.length>0)this.validRowsIndex=a;else{this.validRowsIndex=[];for(var e=this.refRow;e0)if(c.style.visibility="visible",this.pageSelectorType===this.fltTypeSlc)for(var h=0;h=this.startPagingRow&&c>d?("true"!==e.getAttribute("validRow")&&e.getAttribute("validRow")||(e.style.display=""),this.alternateBgs&&this.SetRowBg(this.validRowsIndex[d],d)):(e.style.display="none",this.alternateBgs&&this.RemoveRowBg(this.validRowsIndex[d]))}this.nbVisibleRows=this.validRowsIndex.length,this.isStartBgAlternate=!1,this.ApplyGridProps()},SetPage:function(a){if(this.hasGrid&&this.paging){var b=this.pagingBtnEvents,c=typeof a;if("string"===c)switch(str.lower(a)){case"next":b.next();break;case"previous":b.prev();break;case"last":b.last();break;case"first":b.first();break;default:b.next()}"number"===c&&this.ChangePage(a-1)}},SetResultsPerPage:function(){if((this.hasGrid||this.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){if(!this.Evt._OnSlcResultsChange){var a=this;this.Evt._OnSlcResultsChange=function(){a.ChangeResultsPerPage(),this.blur(),this.parentNode&&hlp.isIE()&&this.parentNode.focus()}}var b=dom.create(this.fltTypeSlc,["id",this.prfxSlcResults+this.id]);b.className=this.resultsSlcCssClass;var c=this.resultsPerPage[0],d=this.resultsPerPage[1],e=dom.create("span",["id",this.prfxSlcResultsTxt+this.id]);e.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||this.SetTopDiv();var f=this.resultsPerPageTgtId?dom.id(this.resultsPerPageTgtId):this.rDiv;e.appendChild(dom.text(c)),f.appendChild(e),f.appendChild(b),this.resultsPerPageSlc=dom.id(this.prfxSlcResults+this.id);for(var g=0;g<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
These operators are described here:
http://tablefilter.free.fr/#operators
',this.helpInstrHtml=a.help_instructions_html||null,this.helpInstrBtnText=a.help_instructions_btn_text||"?",this.helpInstrBtnHtml=a.help_instructions_btn_html||null,this.helpInstrBtnCssClass=a.help_instructions_btn_css_class||"helpBtn",this.helpInstrContCssClass=a.help_instructions_container_css_class||"helpCont",this.helpInstrBtnEl=null,this.helpInstrContEl=null,this.helpInstrDefaultHtml='

HTML Table Filter Generator v. '+this.version+'

http://tablefilter.free.fr
©2009-'+this.year+' Max Guglielmi.
";var b=dom.create("span",["id",this.prfxHelpSpan+this.id]),c=dom.create("div",["id",this.prfxHelpDiv+this.id]);this.helpInstrTgtId||this.SetTopDiv();var d=this.helpInstrTgtId?dom.id(this.helpInstrTgtId):this.rDiv;d.appendChild(b);var e=this.helpInstrContTgtId?dom.id(this.helpInstrContTgtId):b;if(this.helpInstrBtnHtml){b.innerHTML=this.helpInstrBtnHtml;var f=b.firstChild;f.onclick=this.Evt._OnHelpBtnClick,e.appendChild(c)}else{e.appendChild(c);var g=dom.create("a",["href","javascript:void(0);"]);g.className=this.helpInstrBtnCssClass,g.appendChild(dom.text(this.helpInstrBtnText)),b.appendChild(g),g.onclick=this.Evt._OnHelpBtnClick}this.helpInstrHtml?(this.helpInstrContTgtId&&e.appendChild(c),c.innerHTML=this.helpInstrHtml,this.helpInstrContTgtId||(c.className=this.helpInstrContCssClass,c.ondblclick=this.Evt._OnHelpBtnClick)):(c.innerHTML=this.helpInstrText,c.className=this.helpInstrContCssClass,c.ondblclick=this.Evt._OnHelpBtnClick),c.innerHTML+=this.helpInstrDefaultHtml,this.helpInstrContEl=c,this.helpInstrBtnEl=b}},RemoveHelpInstructions:function(){this.helpInstrBtnEl&&(this.helpInstrBtnEl.parentNode.removeChild(this.helpInstrBtnEl),this.helpInstrBtnEl=null,this.helpInstrContEl&&(this.helpInstrContEl.parentNode.removeChild(this.helpInstrContEl),this.helpInstrContEl=null))},_ToggleHelp:function(){if(this.helpInstrContEl){var a=this.helpInstrContEl.style.display;if(""===a||"none"===a){this.helpInstrContEl.style.display="block";var b=dom.position(this.helpInstrBtnEl).left;this.helpInstrContTgtId||(this.helpInstrContEl.style.left=b-this.helpInstrContEl.clientWidth+25+"px")}else this.helpInstrContEl.style.display="none"}},ChangePage:function(a){this.EvtManager(this.Evt.name.changepage,{pgIndex:a})},_ChangePage:function(a){this.paging&&(a||(a=this.pageSelectorType===this.fltTypeSlc?this.pagingSlc.options.selectedIndex:this.pagingSlc.value-1),a>=0&&a<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,a),this.currentPageNb=parseInt(a,10)+1,this.pageSelectorType===this.fltTypeSlc?this.pagingSlc.options[a].selected=!0:this.pagingSlc.value=this.currentPageNb,this.rememberPageNb&&this.RememberPageNb(this.pgNbCookie),this.startPagingRow=this.pageSelectorType===this.fltTypeSlc?this.pagingSlc.value:a*this.pagingLength,this.GroupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,a)))},ChangeResultsPerPage:function(){this.EvtManager(this.Evt.name.changeresultsperpage)},_ChangeResultsPerPage:function(){if(this.paging){var a=this.resultsPerPageSlc,b=this.pageSelectorType==this.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(a.options[a.selectedIndex].value,10),this.startPagingRow=this.pagingLength*b,!isNaN(this.pagingLength)){if(this.startPagingRow>=this.nbFilterableRows&&(this.startPagingRow=this.nbFilterableRows-this.pagingLength),this.SetPagingInfo(),this.pageSelectorType===this.fltTypeSlc){var c=this.pagingSlc.options.length-1<=b?this.pagingSlc.options.length-1:b;this.pagingSlc.options[c].selected=!0}this.rememberPageLen&&this.RememberPageLength(this.pgLenCookie)}}},ResetPage:function(){this.EvtManager(this.Evt.name.resetpage)},_ResetPage:function(a){var b=cookie.read(a);""!==b&&this.ChangePage(b-1)},ResetPageLength:function(){this.EvtManager(this.Evt.name.resetpagelength)},_ResetPageLength:function(a){if(this.paging){var b=cookie.read(a);""!==b&&(this.resultsPerPageSlc.options[b].selected=!0,this.ChangeResultsPerPage())}},AddPaging:function(a){this.hasGrid&&!this.paging&&(this.paging=!0,this.isPagingRemoved=!0,this.SetPaging(),this.ResetValues(),a&&this.Filter())},PopulateSelect:function(a,b,c){this.EvtManager(this.Evt.name.populateselect,{slcIndex:a,slcExternal:b,slcId:c})},_PopulateSelect:function(a,b,c,d){function e(){if("innerhtml"===m)o+='";else{var a=dom.createOpt(j.enableSlcResetFilter?j.displayAllText:"","");if(j.enableSlcResetFilter||(a.style.display="none"),i.appendChild(a),j.enableEmptyOption){var b=dom.createOpt(j.emptyText,j.emOperator);i.appendChild(b)}if(j.enableNonEmptyOption){var c=dom.createOpt(j.nonEmptyText,j.nmOperator);i.appendChild(c)}}}function f(){var c=i.value;i.innerHTML="",e();for(var d=0;d"+g+""}else{var l;l=j.fillSlcOnDemand&&c==n[d]&&j["col"+a]===j.fltTypeSlc?dom.createOpt(g,f,!0):j["col"+a]!=j.fltTypeMulti?dom.createOpt(g,f," "!==r[a]&&f==r[a]?!0:!1):dom.createOpt(g,f,array.has(s,str.matchCase(n[d],j.matchCase),j.matchCase)||-1!==s.toString().indexOf(f)?!0:!1),h&&(l.disabled=!0),i.appendChild(l)}}"innerhtml"===m&&(i.innerHTML+=o),i.setAttribute("filled","1")}c=void 0===c?!1:c;var g=this.fltIds[a];if((dom.id(g)||c)&&(dom.id(d)||!c)){var h,i=dom.id(c?d:g),j=this,k=this.tbl.rows,l=this.matchCase,m=str.lower(this.slcFillingMethod),n=[],o="",p=this.hasCustomSlcOptions&&array.has(this.customSlcOptions.cols,a),q=[];b&&this.activeFilterId&&(h=this.activeFilterId.split("_")[0],h=h.split(this.prfxFlt)[1]);var r=[],s=[];this.rememberGridValues&&(r=cookie.valueToArray(this.fltsValuesCookie,this.separator),r&&!str.isEmpty(r.toString())&&(p?s.push(r[a]):s=r[a].split(" "+j.orOperator+" ")));var t=null,u=null;b&&this.disableExcludedOptions&&(t=[],u=[]);for(var v=this.refRow;vy;y++)if(a===y&&(!b||b&&this.disableExcludedOptions)||a==y&&b&&(""===k[v].style.display&&!this.paging||this.paging&&(!this.validRowsIndex||this.validRowsIndex&&array.has(this.validRowsIndex,v))&&(void 0===h||h==a||h!=a&&array.has(this.validRowsIndex,v)))){var z=this.GetCellData(y,w[y]),A=str.matchCase(z,l);if(array.has(n,A,l)||n.push(z),b&&this.disableExcludedOptions){var B=u[y];B||(B=this.GetFilteredDataCol(y)),!array.has(B,A,l)&&!array.has(t,A,l)&&!this.isFirstLoad&&t.push(z)}}}if(p){var C=this.__getCustomValues(a);n=C[0],q=C[1]}if(this.sortSlc&&!p&&(l?(n.sort(),t&&t.sort()):(n.sort(ignoreCaseSort),t&&t.sort(ignoreCaseSort))),this.sortNumAsc&&array.has(this.sortNumAsc,a))try{n.sort(numSortAsc),t&&t.sort(numSortAsc),p&&q.sort(numSortAsc)}catch(D){n.sort(),t&&t.sort(),p&&q.sort()}if(this.sortNumDesc&&array.has(this.sortNumDesc,a))try{n.sort(numSortDesc),t&&t.sort(numSortDesc),p&&q.sort(numSortDesc)}catch(D){n.sort(),t&&t.sort(),p&&q.sort()}f()}},__deferMultipleSelection:function(a,b,c){if("select"===str.lower(a.nodeName)){var d=void 0===c?!1:c,e=this;global.setTimeout(function(){a.options[0].selected=!1,a.options[b].selected=""===a.options[b].value?!1:!0,d&&e.Filter()},.1)}},__getCustomValues:function(a){if(a){var b=this.hasCustomSlcOptions&&array.has(this.customSlcOptions.cols,a);if(b){for(var c=[],d=[],e=array.indexByValue(this.customSlcOptions.cols,a),f=this.customSlcOptions.values[e],g=this.customSlcOptions.texts[e],h=this.customSlcOptions.sorts[e],i=0;i0&&(j.hasCustomSlcOptions&&array.has(j.customSlcOptions.cols,a)?g.push(i):g=i.split(" "+j.orOperator+" "));for(var k=0;kt;t++)if(a===t&&(!this.refreshFilters||this.refreshFilters&&this.disableExcludedOptions)||a===t&&this.refreshFilters&&(""===k[q].style.display&&!this.paging||this.paging&&(!i||i===a||i!=a&&array.has(this.validRowsIndex,q)))){var u=this.GetCellData(t,r[t]),v=str.matchCase(u,this.matchCase);array.has(l,v,this.matchCase)||l.push(u);var w=p[t];this.refreshFilters&&this.disableExcludedOptions&&(w||(p[t]=this.GetFilteredDataCol(t)),!array.has(w,v,this.matchCase)&&!array.has(o,v,this.matchCase)&&!this.isFirstLoad&&o.push(u))}}if(m){var x=this.__getCustomValues(a);l=x[0],n=x[1]}if(this.sortSlc&&!m&&(this.matchCase?(l.sort(),o&&o.sort()):(l.sort(ignoreCaseSort),o&&o.sort(ignoreCaseSort))),this.sortNumAsc&&array.has(this.sortNumAsc,a))try{l.sort(numSortAsc),o&&o.sort(numSortAsc),m&&n.sort(numSortAsc)}catch(y){l.sort(),o&&o.sort(),m&&n.sort()}if(this.sortNumDesc&&array.has(this.sortNumDesc,a))try{l.sort(numSortDesc),o&&o.sort(numSortDesc),m&&n.sort(numSortDesc)}catch(y){l.sort(),o&&o.sort(),m&&n.sort()}if(e(this.separator),this.fillSlcOnDemand&&(g.innerHTML=""),g.appendChild(h),g.setAttribute("filled","1"),j.rememberGridValues&&hlp.isIE()){var z=h.getAttribute("indexes");if(z)for(var A=z.split(","),B=0;B':null);var b=dom.create("span",["id",this.prfxResetSpan+this.id]);this.btnResetTgtId||this.SetTopDiv();var c=this.btnResetTgtId?dom.id(this.btnResetTgtId):this.rDiv;if(c.appendChild(b),this.btnResetHtml){b.innerHTML=this.btnResetHtml;var d=b.firstChild;d.onclick=this.Evt._Clear}else{var e=dom.create("a",["href","javascript:void(0);"]);e.className=this.btnResetCssClass,e.appendChild(dom.text(this.btnResetText)),b.appendChild(e),e.onclick=this.Evt._Clear}this.btnResetEl=dom.id(this.prfxResetSpan+this.id).firstChild}},RemoveResetBtn:function(){if(this.hasGrid&&this.btnResetEl){var a=dom.id(this.prfxResetSpan+this.id);a&&a.parentNode.removeChild(a),this.btnResetEl=null}},SetStatusBar:function(){if(this.hasGrid||this.isFirstLoad){var a=this.fObj;this.statusBarTgtId=a.status_bar_target_id||null,this.statusBarDiv=null,this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarText=a.status_bar_text||"",this.statusBarCssClass=a.status_bar_css_class||"status",this.statusBarCloseDelay=250;var b=dom.create("div",["id",this.prfxStatus+this.id]);b.className=this.statusBarCssClass;var c=dom.create("span",["id",this.prfxStatusSpan+this.id]),d=dom.create("span",["id",this.prfxStatusTxt+this.id]);d.appendChild(dom.text(this.statusBarText)),this.onBeforeShowMsg=types.isFn(a.on_before_show_msg)?a.on_before_show_msg:null,this.onAfterShowMsg=types.isFn(a.on_after_show_msg)?a.on_after_show_msg:null,this.statusBarTgtId||this.SetTopDiv();var e=this.statusBarTgtId?dom.id(this.statusBarTgtId):this.lDiv;this.statusBarDiv&&hlp.isIE()&&(this.statusBarDiv.outerHTML=""),this.statusBarTgtId?(e.appendChild(d),e.appendChild(c)):(b.appendChild(d),b.appendChild(c),e.appendChild(b)),this.statusBarDiv=dom.id(this.prfxStatus+this.id),this.statusBarSpan=dom.id(this.prfxStatusSpan+this.id),this.statusBarSpanText=dom.id(this.prfxStatusTxt+this.id)}},RemoveStatusBar:function(){(this.hasGrid||this.statusBarDiv)&&(this.statusBarDiv.innerHTML="",this.statusBarDiv.parentNode.removeChild(this.statusBarDiv),this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarDiv=null)},StatusMsg:function(a){a||this.StatusMsg(""),this.status&&this.WinStatusMsg(a),this.statusBar&&this.StatusBarMsg(a)},WinStatusMsg:function(a){this.status&&(this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this,a),global.status=a,this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this,a))},StatusBarMsg:function(a){function b(){c.statusBarSpan.innerHTML=a,c.onAfterShowMsg&&c.onAfterShowMsg.call(null,c,a)}if(this.statusBar&&this.statusBarSpan){this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this,a);var c=this,d=""===a?this.statusBarCloseDelay:1;global.setTimeout(b,d)}},SetRowsCounter:function(){if((this.hasGrid||this.isFirstLoad)&&!this.rowsCounterSpan){var a=this.fObj;this.rowsCounterTgtId=a.rows_counter_target_id||null,this.rowsCounterDiv=null,this.rowsCounterSpan=null,this.rowsCounterText=a.rows_counter_text||"Rows: ",this.fromToTextSeparator=a.from_to_text_separator||"-",this.overText=a.over_text||" / ",this.totRowsCssClass=a.tot_rows_css_class||"tot",this.onBeforeRefreshCounter=types.isFn(a.on_before_refresh_counter)?a.on_before_refresh_counter:null,this.onAfterRefreshCounter=types.isFn(a.on_after_refresh_counter)?a.on_after_refresh_counter:null;var b=dom.create("div",["id",this.prfxCounter+this.id]);b.className=this.totRowsCssClass;var c=dom.create("span",["id",this.prfxTotRows+this.id]),d=dom.create("span",["id",this.prfxTotRowsTxt+this.id]);d.appendChild(dom.text(this.rowsCounterText)),this.rowsCounterTgtId||this.SetTopDiv();var e=this.rowsCounterTgtId?dom.id(this.rowsCounterTgtId):this.lDiv;this.rowsCounterDiv&&hlp.isIE()&&(this.rowsCounterDiv.outerHTML=""),this.rowsCounterTgtId?(e.appendChild(d),e.appendChild(c)):(b.appendChild(d),b.appendChild(c),e.appendChild(b)),this.rowsCounterDiv=dom.id(this.prfxCounter+this.id),this.rowsCounterSpan=dom.id(this.prfxTotRows+this.id),this.RefreshNbRows()}},RemoveRowsCounter:function(){this.hasGrid&&this.rowsCounterSpan&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?hlp.isIE()?this.rowsCounterDiv.outerHTML="":this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv):dom.id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null)},RefreshNbRows:function(a){if(this.rowsCounterSpan){this.onBeforeRefreshCounter&&this.onBeforeRefreshCounter.call(null,this,this.rowsCounterSpan);var b;if(this.paging){var c=parseInt(this.startPagingRow,10)+(this.nbVisibleRows>0?1:0),d=c+this.pagingLength-1<=this.nbVisibleRows?c+this.pagingLength-1:this.nbVisibleRows;b=c+this.fromToTextSeparator+d+this.overText+this.nbVisibleRows}else b=a&&""!==a?a:this.nbFilterableRows-this.nbHiddenRows-(this.hasVisibleRows?this.visibleRows.length:0);this.rowsCounterSpan.innerHTML=b,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,this,this.rowsCounterSpan,b)}},SetWatermark:function(a){if(this.fltGrid||""!==this.inpWatermark){a=void 0===a?!0:a;for(var b=0;b0&&this.tbl.removeChild(t[0]),this.headTbl.style.width=this.tbl.style.width,this.headTbl.style.tableLayout="fixed",this.tbl.style.tableLayout="fixed",this.headTbl.cellPadding=this.tbl.cellPadding,this.headTbl.cellSpacing=this.tbl.cellSpacing,this.headTblCont.style.width=this.tblCont.clientWidth+"px",this.SetColWidths(),this.tbl.style.width="",hlp.isIE()&&(this.headTbl.style.width="");var u=this;if(this.tblCont.onscroll=function(){u.headTblCont.scrollLeft=this.scrollLeft;var a=this;if(!u.isPointerXOverwritten)try{TF.Evt.pointerX=function(b){b=b||global.event;var c=tf_StandardBody().scrollLeft+a.scrollLeft;return b.pageX+a.scrollLeft||b.clientX+c},u.isPointerXOverwritten=!0}catch(b){u.isPointerXOverwritten=!1}},a.sort!==!1&&(this.sort=!0,this.sortConfig.asyncSort=!0,this.sortConfig.triggerIds=j),this.gridEnableColResizer&&(this.hasExtensions?this.__containsStr("colsresizer",str.lower(this.extensions.src.toString()))||(this.extensions.name.push("ColumnsResizer_"+this.id),this.extensions.src.push(this.gridColResizerPath),this.extensions.description.push("Columns Resizing"),this.extensions.initialize.push(function(a){a.SetColsResizer("ColumnsResizer_"+a.id)})):(this.extensions={name:["ColumnsResizer_"+this.id],src:[this.gridColResizerPath],description:["Columns Resizing"],initialize:[function(a){a.SetColsResizer("ColumnsResizer_"+a.id)}]},this.hasExtensions=!0)),a.col_resizer_cols_headers_table=this.headTbl.getAttribute("id"),a.col_resizer_cols_headers_index=this.gridHeadRowIndex,a.col_resizer_width_adjustment=0,a.col_enable_text_ellipsis=!1,u.tblHasColTag=dom.tag(u.tbl,"col").length>0?!0:!1,!hlp.isIE()){var v=function(a){if(a){for(var b=a.nbCells-1;b>=0;b--){var c=dom.create("col",["id",a.id+"_col_"+b]);a.tbl.firstChild.parentNode.insertBefore(c,a.tbl.firstChild),c.style.width=a.colWidth[b],a.gridColElms[b]=c}a.tblHasColTag=!0}};if(u.tblHasColTag)for(var w=dom.tag(u.tbl,"col"),x=0;x0?z[0].insertRow(0):u.tbl.insertRow(0),y.style.height="0px";for(var A=0;A0?z[0].moveRow(a.leadColWidthsRow.rowIndex,0):a.tbl.moveRow(a.leadColWidthsRow.rowIndex,0)}D&&D.call(null,a,b)}}var E=types.isFn(a.on_after_col_resized)?a.on_after_col_resized:null;a.on_after_col_resized=function(a,b){if(b){var c=a.crWColsRow.cells[b].style.width,d=a.gridColElms[b];d.style.width=c;var e=a.crWColsRow.cells[b].clientWidth,f=a.crWRowDataTbl.cells[b].clientWidth;hlp.isIE()&&(a.tbl.style.width=a.headTbl.clientWidth+"px"),e!=f&&!hlp.isIE()&&(a.headTbl.style.width=a.tbl.clientWidth+"px"),E&&E.call(null,a,b)}},this.tbl.clientWidth!==this.headTbl.clientWidth&&(this.tbl.style.width=this.headTbl.clientWidth+"px")}},RemoveGridLayout:function(){if(this.gridLayout){var a=this.tbl.parentNode.removeChild(this.tbl);this.tblMainCont.parentNode.insertBefore(a,this.tblMainCont),this.tblMainCont.parentNode.removeChild(this.tblMainCont),this.tblMainCont=null,this.headTblCont=null,this.headTbl=null,this.tblCont=null,this.tbl.outerHTML=this.sourceTblHtml,this.tbl=dom.id(this.id)}},SetPopupFilterIcons:function(){function a(a){var b=a||global.event,d=parseInt(this.getAttribute("ci"),10);if(c.CloseAllPopupFilters(d),c.TogglePopupFilter(d),c.popUpFltAdjustToContainer){var e=c.popUpFltElms[d],f=c.GetHeaderElement(d),g=.95*f.clientWidth;if(hlp.isIE()){var h=dom.position(f).left;e.style.left=h+"px"}e.style.width=parseInt(g,10)+"px"}b.cancel(b),b.stop(b)}if(this.popUpFilters){this.isExternalFlt=!0;var b=this.fObj;this.popUpImgFlt=b.popup_filters_image||this.themesPath+"icn_filter.gif",this.popUpImgFltActive=b.popup_filters_image_active||this.themesPath+"icn_filterActive.gif",this.popUpImgFltHtml=b.popup_filters_image_html||'Column filter',this.popUpDivCssClass=b.popup_div_css_class||"popUpFilter",this.onBeforePopUpOpen=types.isFn(b.on_before_popup_filter_open)?b.on_before_popup_filter_open:null,this.onAfterPopUpOpen=types.isFn(b.on_after_popup_filter_open)?b.on_after_popup_filter_open:null,this.onBeforePopUpClose=types.isFn(b.on_before_popup_filter_close)?b.on_before_popup_filter_close:null,this.onAfterPopUpClose=types.isFn(b.on_after_popup_filter_close)?b.on_after_popup_filter_close:null,this.externalFltTgtIds=[],this.popUpFltSpans=[],this.popUpFltImgs=[],this.popUpFltElms=this.popUpFltElmCache||[],this.popUpFltAdjustToContainer=!0;for(var c=this,d=0;de;e++){var f=a?e:this.validRowsIndex[e];this.SetRowBg(f,d),d++}},RemoveAlternateRows:function(){if(this.hasGrid){for(var a=(this.tbl.rows,this.refRow);a= offsetParent.offsetHeight ? 0 - parentNode.parentNode.offsetHeight + offsetParent.offsetHeight + offsetParent.scrollTop : 0);"}}}},RemoveFixedHeaders:function(){if(this.hasGrid&&this.fixedHeaders)if(this.contDiv){this.contDiv.parentNode.insertBefore(this.tbl,this.contDiv),this.contDiv.parentNode.removeChild(this.contDiv),this.contDiv=null;var a=dom.tag(this.tbl,"thead");if(0===a.length)return;var b=dom.tag(a[0],"tr");if(0===b.length)return;for(var c=0;cv):L?(w=formatDate(a.replace(i,""),D),e=w>=v):N?(w=formatDate(a.replace(j,""),D),e=v>=w):M?(w=formatDate(a.replace(l,""),D),e=v>w):O?(w=formatDate(a.replace(m,""),D),e=v.toString()!=w.toString()):P?(w=formatDate(a.replace(o,""),D),e=v.toString()==w.toString()):n.test(a)?e=f.__containsStr(a.replace(n,""),b,null,!1):isValidDate(a,D)?(w=formatDate(a,D),e=v.toString()==w.toString()):H?e=str.isEmpty(b):I&&(e=!str.isEmpty(b));else if(f.hasColNbFormat&&f.colNbFormat[c]?(g=removeNbFormat(b,f.colNbFormat[c]),h=f.colNbFormat[c]):","===f.thousandsSeparator&&"."===f.decimalSeparator?(g=removeNbFormat(b,"us"),h="us"):(g=removeNbFormat(b,"eu"),h="eu"),y)e=g<=removeNbFormat(a.replace(i,""),h);else if(A)e=g>=removeNbFormat(a.replace(j,""),h);else if(x)e=gremoveNbFormat(a.replace(l,""),h);else if(B)e=f.__containsStr(a.replace(m,""),b)?!1:!0;else if(E)e=f.__containsStr(a.replace(n,""),b,null,!1);else if(C)e=f.__containsStr(a.replace(o,""),b,null,!0);else if(F)e=0===b.indexOf(a.replace(p,""))?!0:!1;else if(G){var Q=a.replace(q,"");e=b.lastIndexOf(Q,b.length-1)===b.length-1-(Q.length-1)&&b.lastIndexOf(Q,b.length-1)>-1?!0:!1}else if(H)e=str.isEmpty(b);else if(I)e=!str.isEmpty(b);else if(J)try{var R=a.replace(u,""),S=new RegExp(R);e=S.test(b)}catch(T){e=!1}else{var U=d["col_"+c];e=f.__containsStr(a,b,U?U:this.fltTypeInp)}return e}if(this.fltGrid&&(this.hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),""!==this.inpWatermark&&this.SetWatermark(!1);var c=this.tbl.rows,d=this.fObj||{},e=0;this.validRowsIndex=[];var f=this;this.highlightKeywords&&this.UnhighlightAll(),this.popUpFilters&&this.SetAllPopupFiltersIcon(),this.markActiveColumns&&this.ClearActiveColumns(),this.searchArgs=this.GetFiltersValue();for(var g,h,i=new RegExp(this.leOperator),j=new RegExp(this.geOperator),k=new RegExp(this.lwOperator),l=new RegExp(this.grOperator),m=new RegExp(this.dfOperator),n=new RegExp(str.rgxEsc(this.lkOperator)),o=new RegExp(this.eqOperator),p=new RegExp(this.stOperator),q=new RegExp(this.enOperator),r=new RegExp(this.anOperator),s=(new RegExp(this.curExp),this.emOperator),t=this.nmOperator,u=new RegExp(str.rgxEsc(this.rgxOperator)),v=this.refRow;vB;B++){var C=this.searchArgs[this.singleSearchFlt?0:B],D=this.hasColDateType?this.colDateType[B]:this.defaultDateType;if(""!==C){var E=str.matchCase(this.GetCellData(B,w[B]),this.matchCase),F=C.split(this.orOperator),G=F.length>1?!0:!1,H=C.split(this.anOperator),I=H.length>1?!0:!1;if(G||I){for(var J,K=!1,L=G?F:H,M=0;Mj;j++)if(j===a&&""===d[f].style.display){var k=str.lower(this.GetCellData(j,h[j])),l=this.colNbFormat?this.colNbFormat[a]:null,m=b?removeNbFormat(k,l):k;e.push(m)}}return e}},GetFilterValue:function(a){if(this.fltGrid){var b,c=this.GetFilterElement(a);if(!c)return"";var d=this.fltCol[a];if(d!==this.fltTypeMulti&&d!==this.fltTypeCheckList)b=c.value;else if(d===this.fltTypeMulti){b="";for(var e=0;e=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==str.lower(typeof labelId)&&"object"==str.lower(typeof colIndex)&&"object"==str.lower(typeof operation))for(var row=this.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(this.GetColValues(ucolIndex[ucol],!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;kmaxValue?parseFloat(cvalue):maxValue))}if(1===meanFlag&&(meanValue=sumValue/nbvalues),1===medFlag){var aux=0;nbvalues%2===1?(aux=Math.floor(nbvalues/2),medValue=theList[aux]):medValue=(theList[nbvalues/2]+theList[nbvalues/2-1])/2}var posa;if(1===q1Flag&&(posa=0,posa=Math.floor(nbvalues/4),q1Value=4*posa==nbvalues?(theList[posa-1]+theList[posa])/2:theList[posa]),1===q3Flag){posa=0;var posb=0;posa=Math.floor(nbvalues/4),4*posa===nbvalues?(posb=3*posa,q3Value=(theList[posb]+theList[posb-1])/2):q3Value=theList[nbvalues-posa-1]}for(var i=0;mThisCol>=i;i++){switch(opsThisCol[i]){case"mean":result=meanValue;break;case"sum":result=sumValue;break;case"min":result=minValue;break;case"max":result=maxValue;break;case"median":result=medValue;break;case"q1":result=q1Value;break;case"q3":result=q3Value}var precision=decThisCol[i]&&!isNaN(decThisCol[i])?decThisCol[i]:2;if(oTypeThisCol&&result){if(result=result.toFixed(precision),dom.id(labThisCol[i]))switch(str.lower(oTypeThisCol)){case"innerhtml":dom.id(labThisCol[i]).innerHTML=isNaN(result)||!isFinite(result)||0===nbvalues?".":result;break;case"setvalue":dom.id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=dom.id(labThisCol[i]).firstChild,txtnode=dom.text(result);dom.id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{dom.id(labThisCol[i]).innerHTML=isNaN(result)||!isFinite(result)||0===nbvalues?".":result.toFixed(precision)}catch(e){}}totRowIndex&&row[totRowIndex[ucol]]&&(row[totRowIndex[ucol]].style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,this)}},UnhighlightAll:function(){if(this.highlightKeywords&&this.searchArgs){for(var a=0;a - + HTML Table Filter Generator + @@ -65,12 +66,23 @@
- + \ No newline at end of file diff --git a/src/core.js b/src/core.js index cd71fa90..a98eb78e 100644 --- a/src/core.js +++ b/src/core.js @@ -40,9 +40,9 @@ var global = this, cookie = require('cookie'), types = require('types'), array = require('array'), + hlp = require('helpers'), isValidDate = require('date').isValid, formatDate = require('date').format, - loader = require('modules/loader'), doc = global.document; /** @@ -57,7 +57,7 @@ function TableFilter(id) { this.id = id; this.version = '3.0'; this.year = new Date().getFullYear(); - this.tbl = TF.id(id); + this.tbl = dom.id(id); this.startRow = null; this.refRow = null; this.headersRow = null; @@ -98,7 +98,7 @@ function TableFilter(id) { catch(e){ this.nbCells = this.GetCellsNb(0); } //default script base path - this.basePath = f.base_path!==undefined ? f.base_path : 'TableFilter/'; + this.basePath = f.base_path!==undefined ? f.base_path : ''; /*** filter types ***/ this.fltTypeInp = 'input'; @@ -697,6 +697,9 @@ function TableFilter(id) { //themes path this.themesPath = f.themes_path || this.basePath+'TF_Themes/'; + // Components + this.loaderCpt = null; + /*** TF events ***/ var o = this; this.Evt = { @@ -797,7 +800,7 @@ function TableFilter(id) { _OnInpFocus: function(e) { var _evt = e || global.event; o.activeFilterId = this.getAttribute('id'); - o.activeFlt = TF.id(o.activeFilterId); + o.activeFlt = dom.id(o.activeFilterId); //Watermark if(!o.isInpWatermarkArray){ if(this.value === o.inpWatermark && @@ -827,12 +830,12 @@ function TableFilter(id) { _OnSlcFocus: function(e) { var _evt = e || global.event; o.activeFilterId = this.getAttribute('id'); - o.activeFlt = TF.id(o.activeFilterId); + o.activeFlt = dom.id(o.activeFilterId); // select is populated when element has focus if(o.fillSlcOnDemand && this.getAttribute('filled') === '0'){ var ct = this.getAttribute('ct'); o.PopulateSelect(ct); - if(!TF.isIE){ this.setAttribute('filled','1'); } + if(!hlp.isIE()){ this.setAttribute('filled','1'); } } if(o.popUpFilters){ evt.cancel(_evt); @@ -880,7 +883,7 @@ function TableFilter(id) { =====================================================*/ _OnCheckListFocus: function(e) { o.activeFilterId = this.firstChild.getAttribute('id'); - o.activeFlt = TF.id(o.activeFilterId); + o.activeFlt = dom.id(o.activeFilterId); }, _OnCheckListBlur: function(e){}, /*==================================================== @@ -955,14 +958,13 @@ TableFilter.prototype = { this.isExternalFlt = true; this.SetGridLayout(); //Once grid generated 1st filterable row is 0 again - this.refRow = TF.isIE ? (this.refRow+1) : 0; + this.refRow = hlp.isIE() ? (this.refRow+1) : 0; } if(this.loader){ //this.SetLoader(); var Loader = require('modules/loader'); - this.loaderComponent = new Loader(this); - console.log(this.loaderComponent); + this.loaderCpt = new Loader(this); } if(this.popUpFilters){ @@ -994,7 +996,7 @@ TableFilter.prototype = { if(this.isFirstLoad){ var fltrow; if(!this.gridLayout){ - var thead = TF.tag(this.tbl,'thead'); + var thead = dom.tag(this.tbl,'thead'); if(thead.length > 0){ fltrow = thead[0].insertRow(this.filtersRowIndex); } else { @@ -1072,7 +1074,7 @@ TableFilter.prototype = { //filter is appended in desired element if(externalFltTgtId){ - TF.id(externalFltTgtId).appendChild(slc); + dom.id(externalFltTgtId).appendChild(slc); this.externalFltEls.push(slc); } else { fltcell.appendChild(slc); @@ -1103,7 +1105,7 @@ TableFilter.prototype = { select is disabled and by clicking on element (parent td), users enable drop-down and select is populated at same time. */ - if(this.fillSlcOnDemand && TF.isIE){ + if(this.fillSlcOnDemand && hlp.isIE()){ slc.disabled = true; slc.title = this.activateSlcTooltip; slc.parentNode.onclick = this.Evt._EnableSlc; @@ -1121,7 +1123,7 @@ TableFilter.prototype = { //filter is appended in desired element if(externalFltTgtId){ - TF.id(externalFltTgtId).appendChild(divCont); + dom.id(externalFltTgtId).appendChild(divCont); this.externalFltEls.push(divCont); } else { fltcell.appendChild(divCont); @@ -1161,7 +1163,7 @@ TableFilter.prototype = { //filter is appended in desired element if(externalFltTgtId){ - TF.id(externalFltTgtId).appendChild(inp); + dom.id(externalFltTgtId).appendChild(inp); this.externalFltEls.push(inp); } else { fltcell.appendChild(inp); @@ -1194,7 +1196,7 @@ TableFilter.prototype = { //filter is appended in desired element if(externalFltTgtId){ - TF.id(externalFltTgtId).appendChild(btn); + dom.id(externalFltTgtId).appendChild(btn); } else{ fltcell.appendChild(btn); } @@ -1265,7 +1267,7 @@ TableFilter.prototype = { if(this.loader){ //this.ShowLoader('none'); - this.loaderComponent.show('none'); + this.loaderCpt.show('none'); } /* Loads extensions */ @@ -1351,14 +1353,14 @@ TableFilter.prototype = { } if(o.loader){ //o.ShowLoader('none'); - o.loaderComponent.show('none'); + o.loaderCpt.show('none'); } } if(this.loader || this.status || this.statusBar) { try{ //this.ShowLoader(''); - this.loaderComponent.show(''); + this.loaderCpt.show(''); this.StatusMsg(o['msg'+evt]); } catch(e){} global.setTimeout(efx,this.execDelay); @@ -1551,7 +1553,7 @@ TableFilter.prototype = { } if(this.loader){ // this.RemoveLoader(); - this.loaderComponent.remove(); + this.loaderCpt.remove(); } if(this.popUpFilters){ this.RemovePopupFilters(); @@ -1617,7 +1619,7 @@ TableFilter.prototype = { //custom container if(this.toolBarTgtId){ - TF.id(this.toolBarTgtId).appendChild(infdiv); + dom.id(this.toolBarTgtId).appendChild(infdiv); } //fixed headers else if(this.fixedHeaders && this.contDiv){ @@ -1632,26 +1634,26 @@ TableFilter.prototype = { else{ this.tbl.parentNode.insertBefore(infdiv, this.tbl); } - this.infDiv = TF.id(this.prfxInfDiv+this.id); + this.infDiv = dom.id(this.prfxInfDiv+this.id); /*** left div containing rows # displayer ***/ var ldiv = dom.create('div', ['id',this.prfxLDiv+this.id]); ldiv.className = this.lDivCssClass; infdiv.appendChild(ldiv); - this.lDiv = TF.id(this.prfxLDiv+this.id); + this.lDiv = dom.id(this.prfxLDiv+this.id); /*** right div containing reset button + nb results per page select ***/ var rdiv = dom.create('div', ['id',this.prfxRDiv+this.id]); rdiv.className = this.rDivCssClass; infdiv.appendChild(rdiv); - this.rDiv = TF.id(this.prfxRDiv+this.id); + this.rDiv = dom.id(this.prfxRDiv+this.id); /*** mid div containing paging elements ***/ var mdiv = dom.create('div', ['id',this.prfxMDiv+this.id]); mdiv.className = this.mDivCssClass; infdiv.appendChild(mdiv); - this.mDiv = TF.id(this.prfxMDiv+this.id); + this.mDiv = dom.id(this.prfxMDiv+this.id); if(!this.helpInstructions){ this.SetHelpInstructions(); @@ -1679,99 +1681,13 @@ TableFilter.prototype = { } for(var ct=0; ct0){ this.validRowsIndex = validRows; @@ -2697,7 +2613,7 @@ TableFilter.prototype = { o.ChangeResultsPerPage(); this.blur(); //ie only: blur is not enough... - if(this.parentNode && TF.isIE){ + if(this.parentNode && hlp.isIE()){ this.parentNode.focus(); } }; @@ -2717,12 +2633,12 @@ TableFilter.prototype = { this.SetTopDiv(); } var targetEl = !this.resultsPerPageTgtId ? - this.rDiv : TF.id( this.resultsPerPageTgtId ); + this.rDiv : dom.id( this.resultsPerPageTgtId ); slcRSpan.appendChild(dom.text(slcRText)); targetEl.appendChild(slcRSpan); targetEl.appendChild(slcR); - this.resultsPerPageSlc = TF.id(this.prfxSlcResults+this.id); + this.resultsPerPageSlc = dom.id(this.prfxSlcResults+this.id); for(var r=0; r0){ this.tbl.removeChild(thead[0]); } @@ -4202,7 +4119,7 @@ TableFilter.prototype = { this.SetColWidths(); this.tbl.style.width = ''; - if(TF.isIE){ + if(hlp.isIE()){ this.headTbl.style.width = ''; } @@ -4265,8 +4182,8 @@ TableFilter.prototype = { f.col_enable_text_ellipsis = false; //Cols generation for all browsers excepted IE<=7 - o.tblHasColTag = TF.tag(o.tbl,'col').length > 0 ? true : false; - if(!TF.isIE){ + o.tblHasColTag = dom.tag(o.tbl,'col').length > 0 ? true : false; + if(!hlp.isIE()){ //Col elements are enough to keep column widths after sorting and //filtering var createColTags = function(o){ @@ -4285,7 +4202,7 @@ TableFilter.prototype = { if(!o.tblHasColTag){ createColTags(o); } else { - var cols = TF.tag(o.tbl,'col'); + var cols = dom.tag(o.tbl,'col'); for(var ii=0; ii0 ){ r = tbody[0].insertRow(0); @@ -4356,11 +4273,11 @@ TableFilter.prototype = { var thCW = o.crWColsRow.cells[colIndex].clientWidth; var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; - if(TF.isIE){ + if(hlp.isIE()){ o.tbl.style.width = o.headTbl.clientWidth+'px'; } - if(thCW != tdCW && !TF.isIE){ + if(thCW != tdCW && !hlp.isIE()){ o.headTbl.style.width = o.tbl.clientWidth+'px'; } @@ -4392,7 +4309,7 @@ TableFilter.prototype = { this.tblCont = null; this.tbl.outerHTML = this.sourceTblHtml; - this.tbl = TF.id(this.id); //needed to keep reference + this.tbl = dom.id(this.id); //needed to keep reference }, /*==================================================== @@ -4448,7 +4365,7 @@ TableFilter.prototype = { var popUpDiv = o.popUpFltElms[colIndex], header = o.GetHeaderElement(colIndex), headerWidth = header.clientWidth * 0.95; - if(TF.isIE){ + if(hlp.isIE()){ var headerLeft = dom.position(header).left; popUpDiv.style.left = (headerLeft) + 'px'; } @@ -4695,7 +4612,7 @@ TableFilter.prototype = { // value(s) for filtering if(this['col'+i]===this.fltTypeSlc || this['col'+i]===this.fltTypeMulti){ - var slc = TF.id( this.fltIds[i] ); + var slc = dom.id( this.fltIds[i] ); slc.options[0].selected = false; //selects @@ -4716,7 +4633,7 @@ TableFilter.prototype = { this.hasStoredValues = true; // IE multiple selection work-around - if(TF.isIE){ + if(hlp.isIE()){ this.__deferMultipleSelection(slc,j,false); hasStoredValues = false; } @@ -4841,11 +4758,11 @@ TableFilter.prototype = { if(this.contDiv){ return; } - var thead = TF.tag(this.tbl,'thead'); + var thead = dom.tag(this.tbl,'thead'); if(thead.length===0){ return; } - var tbody = TF.tag(this.tbl,'tbody'); + var tbody = dom.tag(this.tbl,'tbody'); //firefox returns tbody height if(tbody[0].clientHeight!==0){ //previous values @@ -4863,12 +4780,12 @@ TableFilter.prototype = { contDiv.className = this.contDivCssClass; this.tbl.parentNode.insertBefore(contDiv, this.tbl); contDiv.appendChild(this.tbl); - this.contDiv = TF.id(this.prfxContentDiv+this.id); + this.contDiv = dom.id(this.prfxContentDiv+this.id); //prevents headers moving during window scroll (IE) this.contDiv.style.position = 'relative'; var theadH = 0; - var theadTr = TF.tag(thead[0],'tr'); + var theadTr = dom.tag(thead[0],'tr'); //css below emulates fixed headers on IE<=6 for(var i=0; i HTML Table Filter Generator - + @@ -67,19 +67,24 @@
\ No newline at end of file diff --git a/src/modules/loader.js b/src/modules/loader.js index d7e78eac..46163cda 100644 --- a/src/modules/loader.js +++ b/src/modules/loader.js @@ -1,6 +1,5 @@ define(['../dom', '../types'], function (dom, types) { 'use strict'; -console.log(arguments); var global = window; @@ -34,13 +33,13 @@ console.log(arguments); var targetEl = !tf.loaderTgtId ? (tf.gridLayout ? tf.tblCont : tf.tbl.parentNode) : - TF.id(tf.loaderTgtId); + dom.id(tf.loaderTgtId); if(!tf.loaderTgtId){ targetEl.insertBefore(containerDiv, tf.tbl); } else { targetEl.appendChild(containerDiv); } - tf.loaderDiv = TF.id(tf.prfxLoader+tf.id); + tf.loaderDiv = dom.id(tf.prfxLoader+tf.id); if(!tf.loaderHtml){ tf.loaderDiv.appendChild(dom.text(tf.loaderText)); } else { @@ -78,7 +77,7 @@ console.log(arguments); } var targetEl = !this.tf.loaderTgtId ? (this.tf.gridLayout ? this.tf.tblCont : this.tf.tbl.parentNode) : - TF.id(this.tf.loaderTgtId); + dom.id(this.tf.loaderTgtId); targetEl.removeChild(this.tf.loaderDiv); this.tf.loaderDiv = null; }; diff --git a/src/start.frag b/src/start.frag index e69de29b..648ee0b3 100644 --- a/src/start.frag +++ b/src/start.frag @@ -0,0 +1,10 @@ + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define(factory); + } else if (typeof exports === 'object') { + module.exports = factory; + } else { + root.TableFilter = factory(); + } +})(this, function() { diff --git a/src/tf-main.js b/src/tf-main.js deleted file mode 100644 index fc0c3fb5..00000000 --- a/src/tf-main.js +++ /dev/null @@ -1,26 +0,0 @@ - -// requirejs.config({ -// baseUrl: '../dist/libs', -// paths: { -// tf: '.' -// } -// }); - -requirejs(['core'], function(TableFilter){ - // Your logic here - var tf = new TableFilter("demo", { - col_0: 'select', - col_3: 'checklist', - base_path: './', - enable_default_theme: true, - paging: false, - alternate_rows: true, - highlight_keywords: true, - match_case: false, - remember_grid_values: true, - btn_reset: true, - grid_layout: false - }); - - tf.init(); -}); \ No newline at end of file diff --git a/src/types.js b/src/types.js index 9166f7b2..535f9b9b 100644 --- a/src/types.js +++ b/src/types.js @@ -7,6 +7,8 @@ define(function () { var Types = {}; + var UNDEFINED = void 0; + /** * Checks if var exists and is an object * @param {String or Object} v @@ -44,5 +46,14 @@ define(function () { return (obj && obj.constructor == Array); }; + /** + * Determines if passed param is undefined + * @param {Any} o + * @return {Boolean} + */ + Types.isUndef = function(o){ + return o === UNDEFINED; + }; + return Types; });