{"size": 16512, "ext": "js", "max_stars_repo_path": "libs/jquery-easyui-extension/20191228/datagrid-filter.min.js", "max_stars_repo_name": "homezzm/cnd", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "libs/jquery-easyui-extension/20191228/datagrid-filter.min.js", "max_issues_repo_name": "homezzm/cnd", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "libs/jquery-easyui-extension/20191228/datagrid-filter.min.js", "max_forks_repo_name": "homezzm/cnd", "max_forks_repo_forks_event_min_datetime": "2019-12-11T07:36:34.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-11T07:36:34.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 16512.0, "max_line_length": 16512, "alphanum_fraction": 0.7059714147}
!function(a){function b(b){return a(b).data("treegrid")?"treegrid":"datagrid"}function l(b,c){function i(b){var c=0;return a(b).children(":visible").each(function(){c+=a(this)._outerWidth()}),c}var d=!1,e=a(b),f=e.datagrid("getPanel").find("div.datagrid-header"),g=f.find(".datagrid-header-row:not(.datagrid-filter-row)"),h=c?f.find('.datagrid-filter[name="'+c+'"]'):f.find(".datagrid-filter");h.each(function(){var b=a(this).attr("name"),c=e.datagrid("getColumnOption",b),f=a(this).closest("div.datagrid-filter-c"),h=f.find("a.datagrid-filter-btn"),j=g.find('td[field="'+b+'"] .datagrid-cell'),k=j._outerWidth();k!=i(f)&&this.filter.resize(this,k-h._outerWidth()),f.width()>c.boxWidth+c.deltaWidth-1&&(c.boxWidth=f.width()-c.deltaWidth+1,c.width=c.boxWidth+c.deltaWidth,d=!0)}),d&&a(b).datagrid("fixColumnSize")}function m(b,c){var d=a(b).datagrid("getPanel").find("div.datagrid-header");return d.find('tr.datagrid-filter-row td[field="'+c+'"] .datagrid-filter')}function n(c,d){var g,e=b(c),f=a(c)[e]("options").filterRules;for(g=0;g<f.length;g++)if(f[g].field==d)return g;return-1}function o(c,d){var e=b(c),f=a(c)[e]("options").filterRules,g=n(c,d);return g>=0?f[g]:null}function p(c,d){var h,i,j,k,l,e=b(c),f=a(c)[e]("options"),g=f.filterRules;"nofilter"==d.op?q(c,d.field):(h=n(c,d.field),h>=0?a.extend(g[h],d):g.push(d)),i=m(c,d.field),i.length&&("nofilter"!=d.op&&(j=i.val(),i.data("textbox")&&(j=i.textbox("getText")),j!=d.value&&i[0].filter.setValue(i,d.value)),k=i[0].menu,k&&(k.find("."+f.filterMenuIconCls).removeClass(f.filterMenuIconCls),l=k.menu("findItem",f.operators[d.op]["text"]),k.menu("setIcon",{target:l.target,iconCls:f.filterMenuIconCls})))}function q(c,d){function j(a){var b,d,e;for(b=0;b<a.length;b++)d=m(c,a[b]),d.length&&(d[0].filter.setValue(d,""),e=d[0].menu,e&&e.find("."+g.filterMenuIconCls).removeClass(g.filterMenuIconCls))}var h,i,e=b(c),f=a(c),g=f[e]("options");d?(h=n(c,d),h>=0&&g.filterRules.splice(h,1),j([d])):(g.filterRules=[],i=f.datagrid("getColumnFields",!0).concat(f.datagrid("getColumnFields")),j(i))}function r(c){var d=b(c),e=a.data(c,d),f=e.options;f.remoteFilter?a(c)[d]("load"):("scrollview"==f.view.type&&e.data.firstRows&&e.data.firstRows.length&&(e.data.rows=e.data.firstRows),a(c)[d]("getPager").pagination("refresh",{pageNumber:1}),a(c)[d]("options").pageNumber=1,a(c)[d]("loadData",e.filterSource||e.data))}function s(b,c,d){var f,e=a(b).treegrid("options");return c&&c.length?(f=[],a.map(c,function(a){a._parentId=d,f.push(a),f=f.concat(s(b,a.children,a[e.idField]))}),a.map(f,function(a){a.children=void 0}),f):[]}function t(c,d){function q(a){for(var d,e,b=[],c=h.pageNumber;c>0&&(d=(c-1)*parseInt(h.pageSize),e=d+parseInt(h.pageSize),b=a.slice(d,e),!b.length);)c--;return{pageNumber:c>0?c:1,rows:b}}var i,j,k,l,m,n,o,p,e=this,f=b(e),g=a.data(e,f),h=g.options;if("datagrid"==f&&a.isArray(c)?c={total:c.length,rows:c}:"treegrid"==f&&a.isArray(c)&&(i=s(e,c,d),c={total:i.length,rows:i}),!h.remoteFilter||h.clientPaging){if(g.filterSource){if(h.isSorting)h.isSorting=void 0;else if("datagrid"==f)g.filterSource=c;else if(g.filterSource.total+=c.length,g.filterSource.rows=g.filterSource.rows.concat(c.rows),d)return h.filterMatcher.call(e,c)}else g.filterSource=c;!h.remoteSort&&h.sortName&&(j=h.sortName.split(","),k=h.sortOrder.split(","),l=a(e),g.filterSource.rows.sort(function(a,b){var d,e,f,g,h,c=0;for(d=0;d<j.length;d++)if(e=j[d],f=k[d],g=l.datagrid("getColumnOption",e),h=g.sorter||function(a,b){return a==b?0:a>b?1:-1},c=h(a[e],b[e])*("asc"==f?1:-1),0!=c)return c;return c})),c=h.filterMatcher.call(e,{total:g.filterSource.total,rows:g.filterSource.rows,footer:g.filterSource.footer||[]})}return h.pagination&&h.clientPaging&&(l=a(e),m=l[f]("getPager"),m.pagination({onSelectPage:function(a,b){h.pageNumber=a,h.pageSize=b,m.pagination("refresh",{pageNumber:a,pageSize:b}),h.clientPaging?l[f]("loadData",g.filterSource):l[f]("reload")},onBeforeRefresh:function(){return l[f]("reload"),!1}}),"datagrid"==f?(n=q(c.rows),h.pageNumber=n.pageNumber,c.rows=n.rows):(o=[],p=[],a.map(c.rows,function(a){a._parentId?p.push(a):o.push(a)}),c.total=o.length,n=q(o),h.pageNumber=n.pageNumber,c.rows=n.rows.concat(p))),a.map(c.rows,function(a){a.children=void 0}),c}function u(c,d){function n(){a("#datagrid-filter-style").length||a("head").append('<style id="datagrid-filter-style">a.datagrid-filter-btn{display:inline-block;width:22px;height:100%;margin:0;vertical-align:middle;cursor:pointer;opacity:0.6;filter:alpha(opacity=60);}a:hover.datagrid-filter-btn{opacity:1;filter:alpha(opacity=100);}.datagrid-filter-row .textbox,.datagrid-filter-row .textbox .textbox-text{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;}.datagrid-filter-row input{margin:0;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;}.datagrid-filter-c{overflow:hidden}.datagrid-filter-cache{position:absolute;width:10px;height:10px;left:-99999px;}</style>')}function o(b){var i,j,k,m,n,o,p,r,t,u,d=f.dc,h=a(c).datagrid("getColumnFields",b);for(b&&g.rownumbers&&h.unshift("_"),i=(b?d.header1:d.header2).find("table.datagrid-htable"),i.find(".datagrid-filter").each(function(){this.filter.destroy&&this.filter.destroy(this),this.menu&&a(this.menu).menu("destroy")}),i.find("tr.datagrid-filter-row").remove(),j=a('<tr class="datagrid-header-row datagrid-filter-row"></tr>'),"bottom"==g.filterPosition?j.appendTo(i.find("tbody")):j.prependTo(i.find("tbody")),g.showFilterBar||j.hide(),k=0;k<h.length;k++)m=h[k],n=a(c).datagrid("getColumnOption",m),o=a("<td></td>").attr("field",m).appendTo(j),n&&n.hidden&&o.hide(),"_"!=m&&(n&&(n.checkbox||n.expander)||(p=s(m),p?a(c)[e]("destroyFilter",m):p=a.extend({},{field:m,type:g.defaultFilterType,options:g.defaultFilterOptions}),r=g.filterCache[m],r?r.appendTo(o):(r=a('<div class="datagrid-filter-c"></div>').appendTo(o),t=g.filters[p.type],u=t.init(r,a.extend({height:g.editorHeight},p.options||{})),u.addClass("datagrid-filter").attr("name",m),u[0].filter=t,u[0].filterOptions=p,u[0].menu=q(r,p.op),p.op&&p.op.length?p.options&&p.options.onInit?p.options.onInit.call(u[0],c):p.defaultFilterOperator&&g.defaultFilterOptions.onInit.call(u[0],c):g.defaultFilterOptions.onInit.call(u[0],c),g.filterCache[m]=r,l(c,m))))}function q(b,d){var e,f;return d?(e=a('<a class="datagrid-filter-btn">&nbsp;</a>').addClass(g.filterBtnIconCls),e.css("height",g.editorHeight),"right"==g.filterBtnPosition?e.appendTo(b):e.prependTo(b),f=a("<div></div>").appendTo("body"),a.map(["nofilter"].concat(d),function(b){var c=g.operators[b];c&&a("<div></div>").attr("name",b).html(c.text).appendTo(f)}),f.menu({alignTo:e,onClick:function(b){var d=a(this).menu("options").alignTo,e=d.closest("td[field]"),f=e.attr("field"),h=e.find(".datagrid-filter"),i=h[0].filter.getValue(h);0!=g.onClickMenu.call(c,b,d,f)&&(p(c,{field:f,op:b.name,value:i}),r(c))}}),e[0].menu=f,e.bind("click",{menu:f},function(){return a(this.menu).menu("show"),!1}),f):null}function s(a){var b,c;for(b=0;b<d.length;b++)if(c=d[b],c.field==a)return c;return null}var e,f,g,h,i,j,k,m;d=d||[],e=b(c),f=a.data(c,e),g=f.options,g.filterRules.length||(g.filterRules=[]),g.filterCache=g.filterCache||{},h=a.data(c,"datagrid").options,i=h.onResize,h.onResize=function(a,b){l(c),i.call(this,a,b)},j=h.onBeforeSortColumn,h.onBeforeSortColumn=function(a,b){var c=j.call(this,a,b);return 0!=c&&(g.isSorting=!0),c},k=g.onResizeColumn,g.onResizeColumn=function(b,d){var e=a(this).datagrid("getPanel").find(".datagrid-header .datagrid-filter-c"),f=e.find(".datagrid-filter:focus");e.css({width:"1px",height:0}),a(c).datagrid("fitColumns"),g.fitColumns?l(c):l(c,b),e.css({width:"",height:""}),f.blur().focus(),k.call(c,b,d)},m=g.onBeforeLoad,g.onBeforeLoad=function(a,b){var c,d,h,i;if(a&&(a.filterRules=g.filterStringify(g.filterRules)),b&&(b.filterRules=g.filterStringify(g.filterRules)),c=m.call(this,a,b),0!=c&&g.url)if("datagrid"==e)f.filterSource=null;else if("treegrid"==e&&f.filterSource)if(a){for(d=a[g.idField],h=f.filterSource.rows||[],i=0;i<h.length;i++)if(d==h[i]._parentId)return!1}else f.filterSource=null;return c},g.loadFilter=function(a,b){var c=g.oldLoadFilter.call(this,a,b);return t.call(this,c,b)},f.dc.view2.children(".datagrid-header").unbind(".filter").bind("focusin.filter",function(){var c=a(this);setTimeout(function(){f.dc.body2._scrollLeft(c._scrollLeft())},0)}),n(),o(!0),o(),g.fitColumns&&setTimeout(function(){l(c)},0),a.map(g.filterRules,function(a){p(c,a)})}var g,h,i,j,k,c=a.fn.datagrid.methods.autoSizeColumn,d=a.fn.datagrid.methods.loadData,e=a.fn.datagrid.methods.appendRow,f=a.fn.datagrid.methods.deleteRow;a.extend(a.fn.datagrid.methods,{autoSizeColumn:function(b,d){return b.each(function(){var b=a(this).datagrid("getPanel").find(".datagrid-header .datagrid-filter-c");b.css({width:"1px",height:0}),c.call(a.fn.datagrid.methods,a(this),d),b.css({width:"",height:""}),l(this,d)})},loadData:function(b,c){return b.each(function(){a.data(this,"datagrid").filterSource=null}),d.call(a.fn.datagrid.methods,b,c)},appendRow:function(b,c){var d=e.call(a.fn.datagrid.methods,b,c);return b.each(function(){var b=a(this).data("datagrid");b.filterSource&&(b.filterSource.total++,b.filterSource.rows!=b.data.rows&&b.filterSource.rows.push(c))}),d},deleteRow:function(b,c){return b.each(function(){var e,f,b=a(this).data("datagrid"),d=b.options;if(b.filterSource&&d.idField)if(b.filterSource.rows==b.data.rows)b.filterSource.total--;else for(e=0;e<b.filterSource.rows.length;e++)if(f=b.filterSource.rows[e],f[d.idField]==b.data.rows[c][d.idField]){b.filterSource.rows.splice(e,1),b.filterSource.total--;break}}),f.call(a.fn.datagrid.methods,b,c)}}),g=a.fn.treegrid.methods.loadData,h=a.fn.treegrid.methods.append,i=a.fn.treegrid.methods.insert,j=a.fn.treegrid.methods.remove,a.extend(a.fn.treegrid.methods,{loadData:function(b,c){return b.each(function(){a.data(this,"treegrid").filterSource=null}),g.call(a.fn.treegrid.methods,b,c)},append:function(b,c){return b.each(function(){var e,b=a(this).data("treegrid"),d=b.options;d.oldLoadFilter?(e=s(this,c.data,c.parent),b.filterSource.total+=e.length,b.filterSource.rows=b.filterSource.rows.concat(e),a(this).treegrid("loadData",b.filterSource)):h(a(this),c)})},insert:function(b,c){return b.each(function(){function k(a){var e,c=b.filterSource.rows;for(e=0;e<c.length;e++)if(c[e][d.idField]==a)return e;return-1}var f,g,h,j,b=a(this).data("treegrid"),d=b.options;d.oldLoadFilter?(c.before||c.after,f=k(c.before||c.after),g=f>=0?b.filterSource.rows[f]._parentId:null,h=s(this,[c.data],g),j=b.filterSource.rows.splice(0,f>=0?c.before?f:f+1:b.filterSource.rows.length),j=j.concat(h),j=j.concat(b.filterSource.rows),b.filterSource.total+=h.length,b.filterSource.rows=j,a(this).treegrid("loadData",b.filterSource)):i(a(this),c)})},remove:function(b,c){return b.each(function(){var d,e,f,b=a(this).data("treegrid");if(b.filterSource)for(d=b.options,e=b.filterSource.rows,f=0;f<e.length;f++)if(e[f][d.idField]==c){e.splice(f,1),b.filterSource.total--;break}}),j(b,c)}}),k={filterMenuIconCls:"icon-ok",filterBtnIconCls:"icon-filter",filterBtnPosition:"right",filterPosition:"bottom",remoteFilter:!1,clientPaging:!0,showFilterBar:!0,filterDelay:400,filterRules:[],filterMatchingType:"all",filterIncludingChild:!1,filterMatcher:function(c){function n(b,c){var d,f,h,i,j,l,m,n;if(g.val==a.fn.combogrid.defaults.val&&(g.val=k.val),d=g.filterRules,!d.length)return!0;for(f=0;f<d.length;f++)if(h=d[f],i=e.datagrid("getColumnOption",h.field),j=i&&i.formatter?i.formatter(b[h.field],b,c):void 0,l=g.val.call(e[0],b,h.field,j),void 0==l&&(l=""),m=g.operators[h.op],n=m.isMatch(l,h.value),"any"==g.filterMatchingType){if(n)return!0}else if(!n)return!1;return"all"==g.filterMatchingType}function o(a,b){var c,d;for(c=0;c<a.length;c++)if(d=a[c],d[g.idField]==b)return d;return null}function p(b,c){for(var f,h,d=q(b,c),e=a.extend(!0,[],d);e.length;)f=e.shift(),h=q(b,f[g.idField]),d=d.concat(h),e=e.concat(h);return d}function q(a,b){var d,e,c=[];for(d=0;d<a.length;d++)e=a[d],e._parentId==b&&c.push(e);return c}var h,i,j,l,m,d=b(this),e=a(this),f=a.data(this,d),g=f.options;if(g.filterRules.length){if(h=[],"treegrid"==d){i={},a.map(c.rows,function(b){var d,e;if(n(b,b[g.idField])){for(i[b[g.idField]]=b,d=o(c.rows,b._parentId);d;)i[d[g.idField]]=d,d=o(c.rows,d._parentId);g.filterIncludingChild&&(e=p(c.rows,b[g.idField]),a.map(e,function(a){i[a[g.idField]]=a}))}});for(j in i)h.push(i[j])}else for(l=0;l<c.rows.length;l++)m=c.rows[l],n(m,l)&&h.push(m);c={total:c.total-(c.rows.length-h.length),rows:h}}return c},defaultFilterType:"text",defaultFilterOperator:"contains",defaultFilterOptions:{onInit:function(c){function i(){var j,b=a(c)[d]("getFilterRule",g),i=h.val();""!=i?(b&&b.value!=i||!b)&&(j=b?b.op:f?f.defaultFilterOperator||e.defaultFilterOperator:e.defaultFilterOperator,a(c)[d]("addFilterRule",{field:g,op:j,value:i}),a(c)[d]("doFilter")):b&&(a(c)[d]("removeFilterRule",g),a(c)[d]("doFilter"))}var d=b(c),e=a(c)[d]("options"),f=this.filterOptions,g=a(this).attr("name"),h=a(this);h.data("textbox")&&(h=h.textbox("textbox")),h.unbind(".filter").bind("keydown.filter",function(b){a(this),this.timer&&clearTimeout(this.timer),13==b.keyCode?i():e.filterDelay&&(this.timer=setTimeout(function(){i()},e.filterDelay))})}},filterStringify:function(a){return JSON.stringify(a)},val:function(a,b,c){return c||a[b]},onClickMenu:function(){}},a.extend(a.fn.datagrid.defaults,k),a.extend(a.fn.treegrid.defaults,k),a.fn.datagrid.defaults.filters=a.extend({},a.fn.datagrid.defaults.editors,{label:{init:function(b){return a("<span></span>").appendTo(b)},getValue:function(b){return a(b).html()},setValue:function(b,c){a(b).html(c)},resize:function(b,c){a(b)._outerWidth(c)._outerHeight(22)}}}),a.fn.treegrid.defaults.filters=a.fn.datagrid.defaults.filters,a.fn.datagrid.defaults.operators={nofilter:{text:"No Filter"},contains:{text:"Contains",isMatch:function(a,b){return a=String(a),b=String(b),a.toLowerCase().indexOf(b.toLowerCase())>=0}},equal:{text:"Equal",isMatch:function(a,b){return a==b}},notequal:{text:"Not Equal",isMatch:function(a,b){return a!=b}},beginwith:{text:"Begin With",isMatch:function(a,b){return a=String(a),b=String(b),0==a.toLowerCase().indexOf(b.toLowerCase())}},endwith:{text:"End With",isMatch:function(a,b){return a=String(a),b=String(b),-1!==a.toLowerCase().indexOf(b.toLowerCase(),a.length-b.length)}},less:{text:"Less",isMatch:function(a,b){return b>a}},lessorequal:{text:"Less Or Equal",isMatch:function(a,b){return b>=a}},greater:{text:"Greater",isMatch:function(a,b){return a>b}},greaterorequal:{text:"Greater Or Equal",isMatch:function(a,b){return a>=b}}},a.fn.treegrid.defaults.operators=a.fn.datagrid.defaults.operators,a.extend(a.fn.datagrid.methods,{enableFilter:function(c,d){return c.each(function(){var c=b(this),e=a.data(this,c).options;if(e.oldLoadFilter){if(!d)return;a(this)[c]("disableFilter")}e.oldLoadFilter=e.loadFilter,u(this,d),a(this)[c]("resize"),e.filterRules.length&&(e.remoteFilter?r(this):e.data&&r(this))})},disableFilter:function(c){return c.each(function(){var f,g,h,i,c=b(this),d=a.data(this,c),e=d.options;if(e.oldLoadFilter){f=a(this).data("datagrid").dc,g=f.view.children(".datagrid-filter-cache"),g.length||(g=a('<div class="datagrid-filter-cache"></div>').appendTo(f.view));for(h in e.filterCache)a(e.filterCache[h]).appendTo(g);i=d.data,d.filterSource&&(i=d.filterSource,a.map(i.rows,function(a){a.children=void 0})),f.header1.add(f.header2).find("tr.datagrid-filter-row").remove(),e.loadFilter=e.oldLoadFilter||void 0,e.oldLoadFilter=null,a(this)[c]("resize"),a(this)[c]("loadData",i)}})},destroyFilter:function(c,d){return c.each(function(){function h(b){var e,c=a(f.filterCache[b]),d=c.find(".datagrid-filter");d.length&&(e=d[0].filter,e.destroy&&e.destroy(d[0])),c.find(".datagrid-filter-btn").each(function(){a(this.menu).menu("destroy")}),c.remove(),f.filterCache[b]=void 0}var g,c=b(this),e=a.data(this,c),f=e.options;if(d)h(d);else{for(g in f.filterCache)h(g);a(this).datagrid("getPanel").find(".datagrid-header .datagrid-filter-row").remove(),a(this).data("datagrid").dc.view.children(".datagrid-filter-cache").remove(),f.filterCache={},a(this)[c]("resize"),a(this)[c]("disableFilter")}})},getFilterRule:function(a,b){return o(a[0],b)},addFilterRule:function(a,b){return a.each(function(){p(this,b)})},removeFilterRule:function(a,b){return a.each(function(){q(this,b)})},doFilter:function(a){return a.each(function(){r(this)})},getFilterComponent:function(a,b){return m(a[0],b)},resizeFilter:function(a,b){return a.each(function(){l(this,b)})}})}(jQuery);