mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2024-12-15 20:59:45 +01:00
122 lines
60 KiB
JavaScript
122 lines
60 KiB
JavaScript
/*!
|
|
SearchBuilder 1.1.0
|
|
©SpryMedia Ltd - datatables.net/license/mit
|
|
*/
|
|
(function(){function H(c){f=c;A=c.fn.dataTable}function I(c){k=c;B=c.fn.dataTable}function J(c){l=c;z=c.fn.DataTable}var f,A,t=window.moment,u=window.luxon,n=function(){function c(a,b,d,e,g){var h=this;void 0===e&&(e=0);void 0===g&&(g=1);if(!A||!A.versionCheck||!A.versionCheck("1.10.0"))throw Error("SearchPane requires DataTables 1.10 or newer");this.classes=f.extend(!0,{},c.classes);this.c=f.extend(!0,{},c.defaults,f.fn.dataTable.ext.searchBuilder,b);b=this.c.i18n;this.s={condition:void 0,conditions:{},
|
|
data:void 0,dataIdx:-1,dataPoints:[],dateFormat:!1,depth:g,dt:a,filled:!1,index:e,topGroup:d,type:"",value:[]};this.dom={buttons:f("<div/>").addClass(this.classes.buttonContainer),condition:f("<select disabled/>").addClass(this.classes.condition).addClass(this.classes.dropDown).addClass(this.classes.italic).attr("autocomplete","hacking"),conditionTitle:f('<option value="" disabled selected hidden/>').text(this.s.dt.i18n("searchBuilder.condition",b.condition)),container:f("<div/>").addClass(this.classes.container),
|
|
data:f("<select/>").addClass(this.classes.data).addClass(this.classes.dropDown).addClass(this.classes.italic),dataTitle:f('<option value="" disabled selected hidden/>').text(this.s.dt.i18n("searchBuilder.data",b.data)),defaultValue:f("<select disabled/>").addClass(this.classes.value).addClass(this.classes.dropDown).addClass(this.classes.select),"delete":f("<button>×</button>").addClass(this.classes["delete"]).addClass(this.classes.button).attr("title",this.s.dt.i18n("searchBuilder.deleteTitle",
|
|
b.deleteTitle)).attr("type","button"),left:f("<button><</button>").addClass(this.classes.left).addClass(this.classes.button).attr("title",this.s.dt.i18n("searchBuilder.leftTitle",b.leftTitle)).attr("type","button"),right:f("<button>></button>").addClass(this.classes.right).addClass(this.classes.button).attr("title",this.s.dt.i18n("searchBuilder.rightTitle",b.rightTitle)).attr("type","button"),value:[f("<select disabled/>").addClass(this.classes.value).addClass(this.classes.dropDown).addClass(this.classes.italic).addClass(this.classes.select)],
|
|
valueTitle:f('<option value="--valueTitle--" selected/>').text(this.s.dt.i18n("searchBuilder.value",b.value))};if(this.c.greyscale)for(f(this.dom.data).addClass(this.classes.greyscale),f(this.dom.condition).addClass(this.classes.greyscale),f(this.dom.defaultValue).addClass(this.classes.greyscale),a=0,d=this.dom.value;a<d.length;a++)f(d[a]).addClass(this.classes.greyscale);this.s.dt.on("draw.dtsp",function(){h._adjustCriteria()});this.s.dt.on("buttons-action",function(){h._adjustCriteria()});f(window).on("resize.dtsp",
|
|
A.util.throttle(function(){h._adjustCriteria()}));this._buildCriteria();return this}c.prototype.updateArrows=function(a,b){void 0===a&&(a=!1);void 0===b&&(b=!0);f(this.dom.container).empty().append(this.dom.data).append(this.dom.condition).append(this.dom.value[0]);this.setListeners();f(this.dom.value[0]).trigger("dtsb-inserted");for(var d=1;d<this.dom.value.length;d++)f(this.dom.container).append(this.dom.value[d]),f(this.dom.value[d]).trigger("dtsb-inserted");1<this.s.depth&&f(this.dom.buttons).append(this.dom.left);
|
|
(!1===this.c.depthLimit||this.s.depth<this.c.depthLimit)&&a?f(this.dom.buttons).append(this.dom.right):f(this.dom.right).remove();f(this.dom.buttons).append(this.dom["delete"]);f(this.dom.container).append(this.dom.buttons);b&&this._adjustCriteria()};c.prototype.destroy=function(){f(this.dom.data).off(".dtsb");f(this.dom.condition).off(".dtsb");f(this.dom["delete"]).off(".dtsb");for(var a=0,b=this.dom.value;a<b.length;a++)f(b[a]).off(".dtsb");f(this.dom.container).remove()};c.prototype.search=function(a,
|
|
b){var d=this.s.conditions[this.s.condition];if(void 0!==this.s.condition&&void 0!==d){var e=a[this.s.dataIdx];if(-1!==this.s.type.indexOf("num")&&(""!==this.s.dt.settings()[0].oLanguage.sDecimal||""!==this.s.dt.settings()[0].oLanguage.sThousands)){e=[a[this.s.dataIdx]];""!==this.s.dt.settings()[0].oLanguage.sDecimal&&(e=a[this.s.dataIdx].split(this.s.dt.settings()[0].oLanguage.sDecimal));if(""!==this.s.dt.settings()[0].oLanguage.sThousands)for(a=0;a<e.length;a++)e[a]=e[a].replace(this.s.dt.settings()[0].oLanguage.sThousands,
|
|
",");e=e.join(".")}"filter"!==this.c.orthogonal.search&&(e=this.s.dt.settings()[0],e=e.oApi._fnGetCellData(e,b,this.s.dataIdx,"string"===typeof this.c.orthogonal?this.c.orthogonal:this.c.orthogonal.search));if("array"===this.s.type)for(Array.isArray(e)||(e=[e]),e.sort(),b=0,a=e;b<a.length;b++){var g=a[b];g&&g.replace(/[\r\n\u2028]/g," ")}else null!==e&&(e=e.replace(/[\r\n\u2028]/g," "));-1!==this.s.type.indexOf("html")&&(e=e.replace(/(<([^>]+)>)/ig,""));null===e&&(e="");return d.search(e,this.s.value,
|
|
this)}};c.prototype.getDetails=function(){var a=this.s.value;if(-1!==this.s.type.indexOf("num")&&(""!==this.s.dt.settings()[0].oLanguage.sDecimal||""!==this.s.dt.settings()[0].oLanguage.sThousands))for(var b=0;b<this.s.value.length;b++){var d=[this.s.value[b].toString()];""!==this.s.dt.settings()[0].oLanguage.sDecimal&&(d=this.s.value[b].split(this.s.dt.settings()[0].oLanguage.sDecimal));if(""!==this.s.dt.settings()[0].oLanguage.sThousands)for(var e=0;e<d.length;e++)d[e]=d[e].replace(this.s.dt.settings()[0].oLanguage.sThousands,
|
|
",");this.s.value[b]=d.join(".")}return{condition:this.s.condition,data:this.s.data,value:a}};c.prototype.getNode=function(){return this.dom.container};c.prototype.populate=function(){this._populateData();-1!==this.s.dataIdx&&(this._populateCondition(),void 0!==this.s.condition&&this._populateValue())};c.prototype.rebuild=function(a){var b=!1,d;this._populateData();if(void 0!==a.data){var e=this.classes.italic,g=this.dom.data;f(this.dom.data).children("option").each(function(){f(this).text()===a.data&&
|
|
(f(this).attr("selected",!0),f(g).removeClass(e),b=!0,d=f(this).val())})}if(b){this.s.data=a.data;this.s.dataIdx=d;this.c.orthogonal=this._getOptions().orthogonal;f(this.dom.dataTitle).remove();this._populateCondition();f(this.dom.conditionTitle).remove();var h;f(this.dom.condition).children("option").each(function(){void 0!==a.condition&&f(this).val()===a.condition&&"string"===typeof a.condition&&(f(this).attr("selected",!0),h=f(this).val())});this.s.condition=h;void 0!==this.s.condition?(f(this.dom.conditionTitle).remove(),
|
|
f(this.dom.condition).removeClass(this.classes.italic),this._populateValue(a)):f(this.dom.conditionTitle).prependTo(this.dom.condition).attr("selected",!0)}};c.prototype.setListeners=function(){var a=this;f(this.dom.data).unbind("input change").on("input change",function(){f(a.dom.dataTitle).attr("selected",!1);f(a.dom.data).removeClass(a.classes.italic);a.s.dataIdx=f(a.dom.data).children("option:selected").val();a.s.data=f(a.dom.data).children("option:selected").text();a.c.orthogonal=a._getOptions().orthogonal;
|
|
a._clearCondition();a._clearValue();a._populateCondition();a.s.filled&&(a.s.filled=!1,a.s.dt.draw(),a.setListeners());a.s.dt.state.save()});f(this.dom.condition).unbind("input change").on("input change",function(){f(a.dom.conditionTitle).attr("selected",!1);f(a.dom.condition).removeClass(a.classes.italic);for(var b=f(a.dom.condition).children("option:selected").val(),d=0,e=Object.keys(a.s.conditions);d<e.length;d++)if(e[d]===b){a.s.condition=b;break}a._clearValue();a._populateValue();b=0;for(d=a.dom.value;b<
|
|
d.length;b++)e=d[b],a.s.filled&&0!==f(a.dom.container).has(e).length&&(a.s.filled=!1,a.s.dt.draw(),a.setListeners());a.s.dt.draw()})};c.prototype._adjustCriteria=function(){if(0!==f(document).has(this.dom.container).length){var a=this.dom.value[this.dom.value.length-1];if(0!==f(this.dom.container).has(a).length){var b=f(a).outerWidth(!0);a=f(a).offset().left+b;var d=f(this.dom.left).offset(),e=f(this.dom.right).offset(),g=f(this.dom["delete"]).offset(),h=0!==f(this.dom.container).has(this.dom.left).length,
|
|
m=0!==f(this.dom.container).has(this.dom.right).length,p=h?d.left:m?e.left:g.left;(15>p-a||h&&d.top!==g.top||m&&e.top!==g.top)&&!f(this.dom.container).parent().hasClass(this.classes.vertical)?(f(this.dom.container).parent().addClass(this.classes.vertical),f(this.s.topGroup).trigger("dtsb-redrawContents")):15<p-(f(this.dom.data).offset().left+f(this.dom.data).outerWidth(!0)+f(this.dom.condition).outerWidth(!0)+b)&&f(this.dom.container).parent().hasClass(this.classes.vertical)&&(f(this.dom.container).parent().removeClass(this.classes.vertical),
|
|
f(this.s.topGroup).trigger("dtsb-redrawContents"))}}};c.prototype._buildCriteria=function(){f(this.dom.data).append(this.dom.dataTitle);f(this.dom.condition).append(this.dom.conditionTitle);f(this.dom.container).append(this.dom.data).append(this.dom.condition);for(var a=0,b=this.dom.value;a<b.length;a++){var d=b[a];f(d).append(this.dom.valueTitle);f(this.dom.container).append(d)}f(this.dom.container).append(this.dom["delete"]).append(this.dom.right);this.setListeners()};c.prototype._clearCondition=
|
|
function(){f(this.dom.condition).empty();f(this.dom.conditionTitle).attr("selected",!0).attr("disabled",!0);f(this.dom.condition).prepend(this.dom.conditionTitle).prop("selectedIndex",0);this.s.conditions={};this.s.condition=void 0};c.prototype._clearValue=function(){if(void 0!==this.s.condition){for(var a=function(g){setTimeout(function(){f(g).remove()},50)},b=0,d=this.dom.value;b<d.length;b++){var e=d[b];a(e)}this.dom.value=[].concat(this.s.conditions[this.s.condition].init(this,c.updateListener));
|
|
f(this.dom.value[0]).insertAfter(this.dom.condition).trigger("dtsb-inserted");for(e=1;e<this.dom.value.length;e++)f(this.dom.value[e]).insertAfter(this.dom.value[e-1]).trigger("dtsb-inserted")}else{a=function(g){setTimeout(function(){f(g).remove()},50)};b=0;for(d=this.dom.value;b<d.length;b++)e=d[b],a(e);f(this.dom.valueTitle).attr("selected",!0);f(this.dom.defaultValue).append(this.dom.valueTitle).insertAfter(this.dom.condition)}this.s.value=[];this.dom.value=[f("<select disabled/>").addClass(this.classes.value).addClass(this.classes.dropDown).addClass(this.classes.italic).addClass(this.classes.select).append(f(this.dom.valueTitle).clone())]};
|
|
c.prototype._getOptions=function(){return f.extend(!0,{},c.defaults,this.s.dt.settings()[0].aoColumns[this.s.dataIdx].searchBuilder)};c.prototype._populateCondition=function(){var a=[],b=Object.keys(this.s.conditions).length;if(0===b){b=f(this.dom.data).children("option:selected").val();this.s.type=this.s.dt.columns().type().toArray()[b];null===this.s.type&&(this.s.dt.draw(),this.setListeners(),this.s.type=this.s.dt.columns().type().toArray()[b]);f(this.dom.condition).attr("disabled",!1).empty().append(this.dom.conditionTitle).addClass(this.classes.italic);
|
|
f(this.dom.conditionTitle).attr("selected",!0);b=this.s.dt.settings()[0].oLanguage.sDecimal;""!==b&&this.s.type.indexOf(b)===this.s.type.length-b.length&&(-1!==this.s.type.indexOf("num-fmt")?this.s.type=this.s.type.replace(b,""):-1!==this.s.type.indexOf("num")&&(this.s.type=this.s.type.replace(b,"")));var d=void 0!==this.c.conditions[this.s.type]?this.c.conditions[this.s.type]:-1!==this.s.type.indexOf("moment")?this.c.conditions.moment:-1!==this.s.type.indexOf("luxon")?this.c.conditions.luxon:this.c.conditions.string;
|
|
-1!==this.s.type.indexOf("moment")?this.s.dateFormat=this.s.type.replace(/moment-/g,""):-1!==this.s.type.indexOf("luxon")&&(this.s.dateFormat=this.s.type.replace(/luxon-/g,""));for(var e=0,g=Object.keys(d);e<g.length;e++){var h=g[e];null!==d[h]&&(this.s.conditions[h]=d[h],b=d[h].conditionName,"function"===typeof b&&(b=b(this.s.dt,this.c.i18n)),a.push(f("<option>",{text:b,value:h}).addClass(this.classes.option).addClass(this.classes.notItalic)))}}else if(0<b)for(f(this.dom.condition).empty().attr("disabled",
|
|
!1).addClass(this.classes.italic),d=0,e=Object.keys(this.s.conditions);d<e.length;d++)h=e[d],b=this.s.conditions[h].conditionName,"function"===typeof b&&(b=b(this.s.dt,this.c.i18n)),h=f("<option>",{text:b,value:h}).addClass(this.classes.option).addClass(this.classes.notItalic),void 0!==this.s.condition&&this.s.condition===b&&(f(h).attr("selected",!0),f(this.dom.condition).removeClass(this.classes.italic)),a.push(h);else{f(this.dom.condition).attr("disabled",!0).addClass(this.classes.italic);return}for(b=
|
|
0;b<a.length;b++)h=a[b],f(this.dom.condition).append(h);f(this.dom.condition).prop("selectedIndex",0)};c.prototype._populateData=function(){var a=this;f(this.dom.data).empty().append(this.dom.dataTitle);if(0===this.s.dataPoints.length)this.s.dt.columns().every(function(h){if(!0===a.c.columns||-1!==a.s.dt.columns(a.c.columns).indexes().toArray().indexOf(h)){for(var m=!1,p=0,q=a.s.dataPoints;p<q.length;p++)if(q[p].index===h){m=!0;break}m||(m=a.s.dt.settings()[0].aoColumns[h],h={index:h,text:(void 0===
|
|
m.searchBuilderTitle?m.sTitle:m.searchBuilderTitle).replace(/(<([^>]+)>)/ig,"")},a.s.dataPoints.push(h),f(a.dom.data).append(f("<option>",{text:h.text,value:h.index}).addClass(a.classes.option).addClass(a.classes.notItalic)))}});else for(var b=function(h){d.s.dt.columns().every(function(p){var q=a.s.dt.settings()[0].aoColumns[p];(void 0===q.searchBuilderTitle?q.sTitle:q.searchBuilderTitle).replace(/(<([^>]+)>)/ig,"")===h.text&&(h.index=p)});var m=f("<option>",{text:h.text.replace(/(<([^>]+)>)/ig,
|
|
""),value:h.index}).addClass(d.classes.option).addClass(d.classes.notItalic);d.s.data===h.text&&(d.s.dataIdx=h.index,f(m).attr("selected",!0),f(d.dom.data).removeClass(d.classes.italic));f(d.dom.data).append(m)},d=this,e=0,g=this.s.dataPoints;e<g.length;e++)b(g[e])};c.prototype._populateValue=function(a){var b=this,d=this.s.filled;this.s.filled=!1;setTimeout(function(){f(b.dom.defaultValue).remove()},50);for(var e=function(m){setTimeout(function(){f(m).remove()},50)},g=0,h=this.dom.value;g<h.length;g++)e(h[g]);
|
|
e=f(this.dom.container).children();if(3<e.length)for(g=2;g<e.length-1;g++)f(e[g]).remove();void 0!==a&&this.s.dt.columns().every(function(m){b.s.dt.settings()[0].aoColumns[m].sTitle===a.data&&(b.s.dataIdx=m)});this.dom.value=[].concat(this.s.conditions[this.s.condition].init(this,c.updateListener,void 0!==a?a.value:void 0));void 0!==a&&void 0!==a.value&&(this.s.value=a.value);f(this.dom.value[0]).insertAfter(this.dom.condition).trigger("dtsb-inserted");for(g=1;g<this.dom.value.length;g++)f(this.dom.value[g]).insertAfter(this.dom.value[g-
|
|
1]).trigger("dtsb-inserted");this.s.filled=this.s.conditions[this.s.condition].isInputValid(this.dom.value,this);this.setListeners();d!==this.s.filled&&(this.s.dt.draw(),this.setListeners())};c.version="1.1.0";c.classes={button:"dtsb-button",buttonContainer:"dtsb-buttonContainer",condition:"dtsb-condition",container:"dtsb-criteria",data:"dtsb-data","delete":"dtsb-delete",dropDown:"dtsb-dropDown",greyscale:"dtsb-greyscale",input:"dtsb-input",italic:"dtsb-italic",joiner:"dtsp-joiner",left:"dtsb-left",
|
|
notItalic:"dtsb-notItalic",option:"dtsb-option",right:"dtsb-right",select:"dtsb-select",value:"dtsb-value",vertical:"dtsb-vertical"};c.initSelect=function(a,b,d,e){void 0===d&&(d=null);void 0===e&&(e=!1);var g=f(a.dom.data).children("option:selected").val(),h=a.s.dt.rows().indexes().toArray(),m=a.s.dt.settings()[0],p=f("<select/>").addClass(c.classes.value).addClass(c.classes.dropDown).addClass(c.classes.italic).addClass(c.classes.select).append(a.dom.valueTitle).on("input change",function(){f(this).removeClass(c.classes.italic);
|
|
b(a,this)});a.c.greyscale&&f(p).addClass(c.classes.greyscale);for(var q=[],y=[],E=0;E<h.length;E++){var x=h[E],v=m.oApi._fnGetCellData(m,x,g,"string"===typeof a.c.orthogonal?a.c.orthogonal:a.c.orthogonal.search);v="string"===typeof v?v.replace(/[\r\n\u2028]/g," "):v;x=m.oApi._fnGetCellData(m,x,g,"string"===typeof a.c.orthogonal?a.c.orthogonal:a.c.orthogonal.display);"array"===a.s.type&&(v=Array.isArray(v)?v=v.sort():[v],x=Array.isArray(x)?x=x.sort():[x]);var G=function(r,w){r=f("<option>",{type:Array.isArray(r)?
|
|
"Array":"String",value:-1!==a.s.type.indexOf("html")&&null!==r&&"string"===typeof r?r.replace(/(<([^>]+)>)/ig,""):r}).addClass(a.classes.option).addClass(a.classes.notItalic).html("string"===typeof w?w.replace(/(<([^>]+)>)/ig,""):w);w=f(r).val();-1===q.indexOf(w)&&(q.push(w),y.push(r),null!==d&&Array.isArray(d[0])&&(d[0]=d[0].sort().join(",")),null!==d&&r.val()===d[0]&&(r.attr("selected",!0),f(p).removeClass(c.classes.italic)))};if(e)for(var C=0;C<v.length;C++)G(v[C],x[C]);else G(v,x)}y.sort(function(r,
|
|
w){if("array"===a.s.type||"string"===a.s.type||"num"===a.s.type||"html"===a.s.type||"html-num"===a.s.type)return f(r).val()<f(w).val()?-1:f(r).val()>f(w).val()?1:0;if("num-fmt"===a.s.type||"html-num-fmt"===a.s.type)return+f(r).val().replace(/[^0-9.]/g,"")<+f(w).val().replace(/[^0-9.]/g,"")?-1:+f(r).val().replace(/[^0-9.]/g,"")>+f(w).val().replace(/[^0-9.]/g,"")?1:0});for(e=0;e<y.length;e++)g=y[e],f(p).append(g);return p};c.initSelectArray=function(a,b,d){void 0===d&&(d=null);return c.initSelect(a,
|
|
b,d,!0)};c.initInput=function(a,b,d){var e=this;void 0===d&&(d=null);var g=a.s.dt.settings()[0].searchDelay;g=f("<input/>").addClass(c.classes.value).addClass(c.classes.input).on("input keypress",a.c.enterSearch&&null===g?a.c.enterSearch?function(h){13===(h.keyCode||h.which)&&b(a,e)}:function(){b(a,e)}:a.s.dt.settings()[0].oApi._fnThrottle(function(){return b(a,this)},g));a.c.greyscale&&f(g).addClass(c.classes.greyscale);null!==d&&f(g).val(d[0]);a.s.dt.one("draw",function(){f(a.s.topGroup).trigger("dtsb-redrawLogic")});
|
|
return g};c.init2Input=function(a,b,d){var e=this;void 0===d&&(d=null);var g=a.s.dt.settings()[0].searchDelay;g=[f("<input/>").addClass(c.classes.value).addClass(c.classes.input).on("input keypress",null!==g?a.s.dt.settings()[0].oApi._fnThrottle(function(){return b(a,this)},g):a.c.enterSearch?function(h){13===(h.keyCode||h.which)&&b(a,e)}:function(){b(a,e)}),f("<span>").addClass(a.classes.joiner).text(a.s.dt.i18n("searchBuilder.valueJoiner",a.c.i18n.valueJoiner)),f("<input/>").addClass(c.classes.value).addClass(c.classes.input).on("input keypress",
|
|
null!==g?a.s.dt.settings()[0].oApi._fnThrottle(function(){return b(a,this)},g):a.c.enterSearch?function(h){13===(h.keyCode||h.which)&&b(a,e)}:function(){b(a,e)})];a.c.greyscale&&(f(g[0]).addClass(c.classes.greyscale),f(g[2]).addClass(c.classes.greyscale));null!==d&&(f(g[0]).val(d[0]),f(g[2]).val(d[1]));a.s.dt.one("draw",function(){f(a.s.topGroup).trigger("dtsb-redrawLogic")});return g};c.initDate=function(a,b,d){var e=this;void 0===d&&(d=null);var g=a.s.dt.settings()[0].searchDelay;g=f("<input/>").addClass(c.classes.value).addClass(c.classes.input).dtDateTime({attachTo:"input",
|
|
format:a.s.dateFormat?a.s.dateFormat:void 0}).on("change",null!==g?a.s.dt.settings()[0].oApi._fnThrottle(function(){return b(a,this)},g):function(){b(a,e)}).on("input keypress",a.c.enterSearch||null===g?a.c.enterSearch?function(h){13===(h.keyCode||h.which)&&b(a,e)}:function(){b(a,e)}:a.s.dt.settings()[0].oApi._fnThrottle(function(){return b(a,this)},g));a.c.greyscale&&f(g).addClass(c.classes.greyscale);null!==d&&f(g).val(d[0]);a.s.dt.one("draw",function(){f(a.s.topGroup).trigger("dtsb-redrawLogic")});
|
|
return g};c.initNoValue=function(a){a.s.dt.one("draw",function(){f(a.s.topGroup).trigger("dtsb-redrawLogic")})};c.init2Date=function(a,b,d){var e=this;void 0===d&&(d=null);var g=a.s.dt.settings()[0].searchDelay;g=[f("<input/>").addClass(c.classes.value).addClass(c.classes.input).dtDateTime({attachTo:"input",format:a.s.dateFormat?a.s.dateFormat:void 0}).on("change",null!==g?a.s.dt.settings()[0].oApi._fnThrottle(function(){return b(a,this)},g):function(){b(a,e)}).on("input keypress",a.c.enterSearch||
|
|
null===g?a.c.enterSearch?function(h){13===(h.keyCode||h.which)&&b(a,e)}:function(){b(a,e)}:a.s.dt.settings()[0].oApi._fnThrottle(function(){return b(a,this)},g)),f("<span>").addClass(a.classes.joiner).text(a.s.dt.i18n("searchBuilder.valueJoiner",a.c.i18n.valueJoiner)),f("<input/>").addClass(c.classes.value).addClass(c.classes.input).dtDateTime({attachTo:"input",format:a.s.dateFormat?a.s.dateFormat:void 0}).on("change",null!==g?a.s.dt.settings()[0].oApi._fnThrottle(function(){return b(a,this)},g):
|
|
function(){b(a,e)}).on("input keypress",a.c.enterSearch||null===g?a.c.enterSearch?function(h){13===(h.keyCode||h.which)&&b(a,e)}:function(){b(a,e)}:a.s.dt.settings()[0].oApi._fnThrottle(function(){return b(a,this)},g))];a.c.greyscale&&(f(g[0]).addClass(c.classes.greyscale),f(g[2]).addClass(c.classes.greyscale));null!==d&&0<d.length&&(f(g[0]).val(d[0]),f(g[2]).val(d[1]));a.s.dt.one("draw",function(){f(a.s.topGroup).trigger("dtsb-redrawLogic")});return g};c.isInputValidSelect=function(a){for(var b=
|
|
!0,d=0;d<a.length;d++){var e=a[d];f(e).children("option:selected").length===f(e).children("option").length-f(e).children("option."+c.classes.notItalic).length&&1===f(e).children("option:selected").length&&f(e).children("option:selected")[0]===f(e).children("option:hidden")[0]&&(b=!1)}return b};c.isInputValidInput=function(a){for(var b=!0,d=0;d<a.length;d++){var e=a[d];f(e).is("input")&&0===f(e).val().length&&(b=!1)}return b};c.inputValueSelect=function(a){for(var b=[],d=0;d<a.length;d++){var e=a[d];
|
|
if(f(e).is("select")){var g=f(e).children("option:selected").val();b.push("Array"===f(e).children("option:selected").attr("type")?g.split(",").sort():g)}}return b};c.inputValueInput=function(a){for(var b=[],d=0;d<a.length;d++){var e=a[d];f(e).is("input")&&b.push(f(e).val())}return b};c.updateListener=function(a,b){var d=a.s.conditions[a.s.condition];a.s.filled=d.isInputValid(a.dom.value,a);a.s.value=d.inputValue(a.dom.value,a);Array.isArray(a.s.value)||(a.s.value=[a.s.value]);for(d=0;d<a.s.value.length;d++)if(Array.isArray(a.s.value[d]))a.s.value[d].sort();
|
|
else if(-1!==a.s.type.indexOf("num")&&(""!==a.s.dt.settings()[0].oLanguage.sDecimal||""!==a.s.dt.settings()[0].oLanguage.sThousands)){var e=[a.s.value[d].toString()];""!==a.s.dt.settings()[0].oLanguage.sDecimal&&(e=a.s.value[d].split(a.s.dt.settings()[0].oLanguage.sDecimal));if(""!==a.s.dt.settings()[0].oLanguage.sThousands)for(var g=0;g<e.length;g++)e[g]=e[g].replace(a.s.dt.settings()[0].oLanguage.sThousands,",");a.s.value[d]=e.join(".")}g=e=null;for(d=0;d<a.dom.value.length;d++)b===a.dom.value[d][0]&&
|
|
(e=d,void 0!==b.selectionStart&&(g=b.selectionStart));a.s.dt.draw();null!==e&&(f(a.dom.value[e]).removeClass(a.classes.italic),f(a.dom.value[e]).focus(),null!==g&&f(a.dom.value[e])[0].setSelectionRange(g,g))};c.dateConditions={"=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.equals",b.conditions.date.equals)},init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=a.replace(/(\/|-|,)/g,"-");return a===b[0]}},"!=":{conditionName:function(a,
|
|
b){return a.i18n("searchBuilder.conditions.date.not",b.conditions.date.not)},init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=a.replace(/(\/|-|,)/g,"-");return a!==b[0]}},"<":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.before",b.conditions.date.before)},init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=a.replace(/(\/|-|,)/g,"-");return a<b[0]}},">":{conditionName:function(a,
|
|
b){return a.i18n("searchBuilder.conditions.date.after",b.conditions.date.after)},init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=a.replace(/(\/|-|,)/g,"-");return a>b[0]}},between:{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.between",b.conditions.date.between)},init:c.init2Date,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=a.replace(/(\/|-|,)/g,"-");return b[0]<b[1]?b[0]<=a&&a<=
|
|
b[1]:b[1]<=a&&a<=b[0]}},"!between":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.notBetween",b.conditions.date.notBetween)},init:c.init2Date,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=a.replace(/(\/|-|,)/g,"-");return b[0]<b[1]?!(b[0]<=a&&a<=b[1]):!(b[1]<=a&&a<=b[0])}},"null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.empty",b.conditions.date.empty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},
|
|
search:function(a){return null===a||void 0===a||0===a.length}},"!null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.notEmpty",b.conditions.date.notEmpty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return!(null===a||void 0===a||0===a.length)}}};c.momentDateConditions={"=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.equals",b.conditions.date.equals)},init:c.initDate,inputValue:c.inputValueInput,
|
|
isInputValid:c.isInputValidInput,search:function(a,b,d){return t(a,d.s.dateFormat).valueOf()===t(b[0],d.s.dateFormat).valueOf()}},"!=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.not",b.conditions.date.not)},init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){return t(a,d.s.dateFormat).valueOf()!==t(b[0],d.s.dateFormat).valueOf()}},"<":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.before",b.conditions.date.before)},
|
|
init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){return t(a,d.s.dateFormat).valueOf()<t(b[0],d.s.dateFormat).valueOf()}},">":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.after",b.conditions.date.after)},init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){return t(a,d.s.dateFormat).valueOf()>t(b[0],d.s.dateFormat).valueOf()}},between:{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.between",
|
|
b.conditions.date.between)},init:c.init2Date,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){a=t(a,d.s.dateFormat).valueOf();var e=t(b[0],d.s.dateFormat).valueOf();b=t(b[1],d.s.dateFormat).valueOf();return e<b?e<=a&&a<=b:b<=a&&a<=e}},"!between":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.notBetween",b.conditions.date.notBetween)},init:c.init2Date,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){a=
|
|
t(a,d.s.dateFormat).valueOf();var e=t(b[0],d.s.dateFormat).valueOf();b=t(b[1],d.s.dateFormat).valueOf();return e<b?!(+e<=+a&&+a<=+b):!(+b<=+a&&+a<=+e)}},"null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.empty",b.conditions.date.empty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return null===a||void 0===a||0===a.length}},"!null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.notEmpty",b.conditions.date.notEmpty)},
|
|
init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return!(null===a||void 0===a||0===a.length)}}};c.luxonDateConditions={"=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.equals",b.conditions.date.equals)},init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){return u.DateTime.fromFormat(a,d.s.dateFormat).ts===u.DateTime.fromFormat(b[0],d.s.dateFormat).ts}},"!=":{conditionName:function(a,
|
|
b){return a.i18n("searchBuilder.conditions.date.not",b.conditions.date.not)},init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){return u.DateTime.fromFormat(a,d.s.dateFormat).ts!==u.DateTime.fromFormat(b[0],d.s.dateFormat).ts}},"<":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.before",b.conditions.date.before)},init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){return u.DateTime.fromFormat(a,
|
|
d.s.dateFormat).ts<u.DateTime.fromFormat(b[0],d.s.dateFormat).ts}},">":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.after",b.conditions.date.after)},init:c.initDate,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){return u.DateTime.fromFormat(a,d.s.dateFormat).ts>u.DateTime.fromFormat(b[0],d.s.dateFormat).ts}},between:{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.between",b.conditions.date.between)},init:c.init2Date,
|
|
inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){a=u.DateTime.fromFormat(a,d.s.dateFormat).ts;var e=u.DateTime.fromFormat(b[0],d.s.dateFormat).ts;b=u.DateTime.fromFormat(b[1],d.s.dateFormat).ts;return e<b?e<=a&&a<=b:b<=a&&a<=e}},"!between":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.notBetween",b.conditions.date.notBetween)},init:c.init2Date,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b,d){a=u.DateTime.fromFormat(a,
|
|
d.s.dateFormat).ts;var e=u.DateTime.fromFormat(b[0],d.s.dateFormat).ts;b=u.DateTime.fromFormat(b[1],d.s.dateFormat).ts;return e<b?!(+e<=+a&&+a<=+b):!(+b<=+a&&+a<=+e)}},"null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.empty",b.conditions.date.empty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return null===a||void 0===a||0===a.length}},"!null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.date.notEmpty",
|
|
b.conditions.date.notEmpty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return!(null===a||void 0===a||0===a.length)}}};c.numConditions={"=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.equals",b.conditions.number.equals)},init:c.initSelect,inputValue:c.inputValueSelect,isInputValid:c.isInputValidSelect,search:function(a,b){return+a===+b[0]}},"!=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.not",
|
|
b.conditions.number.not)},init:c.initSelect,inputValue:c.inputValueSelect,isInputValid:c.isInputValidSelect,search:function(a,b){return+a!==+b[0]}},"<":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.lt",b.conditions.number.lt)},init:c.initInput,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){return+a<+b[0]}},"<=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.lte",b.conditions.number.lte)},init:c.initInput,
|
|
inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){return+a<=+b[0]}},">=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.gte",b.conditions.number.gte)},init:c.initInput,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){return+a>=+b[0]}},">":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.gt",b.conditions.number.gt)},init:c.initInput,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,
|
|
search:function(a,b){return+a>+b[0]}},between:{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.between",b.conditions.number.between)},init:c.init2Input,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){return+b[0]<+b[1]?+b[0]<=+a&&+a<=+b[1]:+b[1]<=+a&&+a<=+b[0]}},"!between":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.notBetween",b.conditions.number.notBetween)},init:c.init2Input,inputValue:c.inputValueInput,
|
|
isInputValid:c.isInputValidInput,search:function(a,b){return+b[0]<+b[1]?!(+b[0]<=+a&&+a<=+b[1]):!(+b[1]<=+a&&+a<=+b[0])}},"null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.empty",b.conditions.number.empty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return null===a||void 0===a||0===a.length}},"!null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.notEmpty",b.conditions.number.notEmpty)},
|
|
init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return!(null===a||void 0===a||0===a.length)}}};c.numFmtConditions={"=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.equals",b.conditions.number.equals)},init:c.initSelect,inputValue:c.inputValueSelect,isInputValid:c.isInputValidSelect,search:function(a,b){a=0===a.indexOf("-")?"-"+a.replace(/[^0-9.]/g,""):a.replace(/[^0-9.]/g,"");b=0===b[0].indexOf("-")?"-"+b[0].replace(/[^0-9.]/g,
|
|
""):b[0].replace(/[^0-9.]/g,"");return+a===+b}},"!=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.not",b.conditions.number.not)},init:c.initSelect,inputValue:c.inputValueSelect,isInputValid:c.isInputValidSelect,search:function(a,b){a=0===a.indexOf("-")?"-"+a.replace(/[^0-9.]/g,""):a.replace(/[^0-9.]/g,"");b=0===b[0].indexOf("-")?"-"+b[0].replace(/[^0-9.]/g,""):b[0].replace(/[^0-9.]/g,"");return+a!==+b}},"<":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.lt",
|
|
b.conditions.number.lt)},init:c.initInput,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=0===a.indexOf("-")?"-"+a.replace(/[^0-9.]/g,""):a.replace(/[^0-9.]/g,"");b=0===b[0].indexOf("-")?"-"+b[0].replace(/[^0-9.]/g,""):b[0].replace(/[^0-9.]/g,"");return+a<+b}},"<=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.lte",b.conditions.number.lte)},init:c.initInput,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,
|
|
b){a=0===a.indexOf("-")?"-"+a.replace(/[^0-9.]/g,""):a.replace(/[^0-9.]/g,"");b=0===b[0].indexOf("-")?"-"+b[0].replace(/[^0-9.]/g,""):b[0].replace(/[^0-9.]/g,"");return+a<=+b}},">=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.gte",b.conditions.number.gte)},init:c.initInput,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=0===a.indexOf("-")?"-"+a.replace(/[^0-9.]/g,""):a.replace(/[^0-9.]/g,"");b=0===b[0].indexOf("-")?"-"+b[0].replace(/[^0-9.]/g,
|
|
""):b[0].replace(/[^0-9.]/g,"");return+a>=+b}},">":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.gt",b.conditions.number.gt)},init:c.initInput,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=0===a.indexOf("-")?"-"+a.replace(/[^0-9.]/g,""):a.replace(/[^0-9.]/g,"");b=0===b[0].indexOf("-")?"-"+b[0].replace(/[^0-9.]/g,""):b[0].replace(/[^0-9.]/g,"");return+a>+b}},between:{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.between",
|
|
b.conditions.number.between)},init:c.init2Input,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=0===a.indexOf("-")?"-"+a.replace(/[^0-9.]/g,""):a.replace(/[^0-9.]/g,"");var d=0===b[0].indexOf("-")?"-"+b[0].replace(/[^0-9.]/g,""):b[0].replace(/[^0-9.]/g,"");b=0===b[1].indexOf("-")?"-"+b[1].replace(/[^0-9.]/g,""):b[1].replace(/[^0-9.]/g,"");return+d<+b?+d<=+a&&+a<=+b:+b<=+a&&+a<=+d}},"!between":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.notBetween",
|
|
b.conditions.number.notBetween)},init:c.init2Input,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){a=0===a.indexOf("-")?"-"+a.replace(/[^0-9.]/g,""):a.replace(/[^0-9.]/g,"");var d=0===b[0].indexOf("-")?"-"+b[0].replace(/[^0-9.]/g,""):b[0].replace(/[^0-9.]/g,"");b=0===b[1].indexOf("-")?"-"+b[1].replace(/[^0-9.]/g,""):b[1].replace(/[^0-9.]/g,"");return+d<+b?!(+d<=+a&&+a<=+b):!(+b<=+a&&+a<=+d)}},"null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.empty",
|
|
b.conditions.number.empty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return null===a||void 0===a||0===a.length}},"!null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.number.notEmpty",b.conditions.number.notEmpty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return!(null===a||void 0===a||0===a.length)}}};c.stringConditions={"=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.string.equals",
|
|
b.conditions.string.equals)},init:c.initSelect,inputValue:c.inputValueSelect,isInputValid:c.isInputValidSelect,search:function(a,b){return a===b[0]}},"!=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.string.not",b.conditions.string.not)},init:c.initSelect,inputValue:c.inputValueSelect,isInputValid:c.isInputValidInput,search:function(a,b){return a!==b[0]}},starts:{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.string.startsWith",b.conditions.string.startsWith)},
|
|
init:c.initInput,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){return 0===a.toLowerCase().indexOf(b[0].toLowerCase())}},contains:{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.string.contains",b.conditions.string.contains)},init:c.initInput,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){return-1!==a.toLowerCase().indexOf(b[0].toLowerCase())}},ends:{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.string.endsWith",
|
|
b.conditions.string.endsWith)},init:c.initInput,inputValue:c.inputValueInput,isInputValid:c.isInputValidInput,search:function(a,b){return a.toLowerCase().endsWith(b[0].toLowerCase())}},"null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.string.empty",b.conditions.string.empty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return null===a||void 0===a||0===a.length}},"!null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.string.notEmpty",
|
|
b.conditions.string.notEmpty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return!(null===a||void 0===a||0===a.length)}}};c.arrayConditions={contains:{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.array.contains",b.conditions.array.contains)},init:c.initSelectArray,inputValue:c.inputValueSelect,isInputValid:c.isInputValidSelect,search:function(a,b){return-1!==a.indexOf(b[0])}},without:{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.array.without",
|
|
b.conditions.array.without)},init:c.initSelectArray,inputValue:c.inputValueSelect,isInputValid:c.isInputValidSelect,search:function(a,b){return-1===a.indexOf(b[0])}},"=":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.array.equals",b.conditions.array.equals)},init:c.initSelect,inputValue:c.inputValueSelect,isInputValid:c.isInputValidSelect,search:function(a,b){if(a.length===b[0].length){for(var d=0;d<a.length;d++)if(a[d]!==b[0][d])return!1;return!0}return!1}},"!=":{conditionName:function(a,
|
|
b){return a.i18n("searchBuilder.conditions.array.not",b.conditions.array.not)},init:c.initSelect,inputValue:c.inputValueSelect,isInputValid:c.isInputValidSelect,search:function(a,b){if(a.length===b[0].length){for(var d=0;d<a.length;d++)if(a[d]!==b[0][d])return!0;return!1}return!0}},"null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.array.empty",b.conditions.array.empty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return null===
|
|
a||void 0===a||0===a.length}},"!null":{conditionName:function(a,b){return a.i18n("searchBuilder.conditions.array.notEmpty",b.conditions.array.notEmpty)},init:c.initNoValue,inputValue:function(){},isInputValid:function(){return!0},search:function(a){return null!==a&&void 0!==a&&0!==a.length}}};c.defaults={columns:!0,conditions:{array:c.arrayConditions,date:c.dateConditions,html:c.stringConditions,"html-num":c.numConditions,"html-num-fmt":c.numFmtConditions,luxon:c.luxonDateConditions,moment:c.momentDateConditions,
|
|
num:c.numConditions,"num-fmt":c.numFmtConditions,string:c.stringConditions},depthLimit:!1,enterSearch:!1,filterChanged:void 0,greyscale:!1,i18n:{add:"Add Condition",button:{0:"Search Builder",_:"Search Builder (%d)"},clearAll:"Clear All",condition:"Condition",data:"Data",deleteTitle:"Delete filtering rule",leftTitle:"Outdent criteria",logicAnd:"And",logicOr:"Or",rightTitle:"Indent criteria",title:{0:"Custom Search Builder",_:"Custom Search Builder (%d)"},value:"Value",valueJoiner:"and"},logic:"AND",
|
|
orthogonal:{display:"display",search:"filter"},preDefined:!1};return c}(),k,B,D=function(){function c(a,b,d,e,g,h){void 0===e&&(e=0);void 0===g&&(g=!1);void 0===h&&(h=1);if(!B||!B.versionCheck||!B.versionCheck("1.10.0"))throw Error("SearchBuilder requires DataTables 1.10 or newer");this.classes=k.extend(!0,{},c.classes);this.c=k.extend(!0,{},c.defaults,b);this.s={criteria:[],depth:h,dt:a,index:e,isChild:g,logic:void 0,opts:b,toDrop:void 0,topGroup:d};this.dom={add:k("<button/>").addClass(this.classes.add).addClass(this.classes.button).attr("type",
|
|
"button"),clear:k("<button>×</button>").addClass(this.classes.button).addClass(this.classes.clearGroup).attr("type","button"),container:k("<div/>").addClass(this.classes.group),logic:k("<button/>").addClass(this.classes.logic).addClass(this.classes.button).attr("type","button"),logicContainer:k("<div/>").addClass(this.classes.logicContainer)};void 0===this.s.topGroup&&(this.s.topGroup=this.dom.container);this._setup();return this}c.prototype.destroy=function(){k(this.dom.add).off(".dtsb");k(this.dom.logic).off(".dtsb");
|
|
k(this.dom.container).trigger("dtsb-destroy").remove();this.s.criteria=[]};c.prototype.getDetails=function(){if(0===this.s.criteria.length)return{};for(var a={criteria:[],logic:this.s.logic},b=0,d=this.s.criteria;b<d.length;b++)a.criteria.push(d[b].criteria.getDetails());return a};c.prototype.getNode=function(){return this.dom.container};c.prototype.rebuild=function(a){if(!(void 0===a.criteria||null===a.criteria||Array.isArray(a.criteria)&&0===a.criteria.length)){this.s.logic=a.logic;k(this.dom.logic).text("OR"===
|
|
this.s.logic?this.s.dt.i18n("searchBuilder.logicOr",this.c.i18n.logicOr):this.s.dt.i18n("searchBuilder.logicAnd",this.c.i18n.logicAnd));if(Array.isArray(a.criteria))for(var b=0,d=a.criteria;b<d.length;b++)a=d[b],void 0!==a.logic?this._addPrevGroup(a):void 0===a.logic&&this._addPrevCriteria(a);b=0;for(d=this.s.criteria;b<d.length;b++)a=d[b],a.criteria instanceof n&&(a.criteria.updateArrows(1<this.s.criteria.length,!1),this._setCriteriaListeners(a.criteria))}};c.prototype.redrawContents=function(){k(this.dom.container).empty().append(this.dom.logicContainer).append(this.dom.add);
|
|
this.s.criteria.sort(function(d,e){return d.criteria.s.index<e.criteria.s.index?-1:d.criteria.s.index>e.criteria.s.index?1:0});this.setListeners();for(var a=0;a<this.s.criteria.length;a++){var b=this.s.criteria[a].criteria;b instanceof n?(this.s.criteria[a].index=a,this.s.criteria[a].criteria.s.index=a,k(this.s.criteria[a].criteria.dom.container).insertBefore(this.dom.add),this._setCriteriaListeners(b),this.s.criteria[a].criteria.rebuild(this.s.criteria[a].criteria.getDetails())):b instanceof c&&
|
|
0<b.s.criteria.length?(this.s.criteria[a].index=a,this.s.criteria[a].criteria.s.index=a,k(this.s.criteria[a].criteria.dom.container).insertBefore(this.dom.add),b.redrawContents(),this._setGroupListeners(b)):(this.s.criteria.splice(a,1),a--)}this.setupLogic()};c.prototype.redrawLogic=function(){for(var a=0,b=this.s.criteria;a<b.length;a++){var d=b[a];d instanceof c&&d.redrawLogic()}this.setupLogic()};c.prototype.search=function(a,b){return"AND"===this.s.logic?this._andSearch(a,b):"OR"===this.s.logic?
|
|
this._orSearch(a,b):!0};c.prototype.setupLogic=function(){k(this.dom.logicContainer).remove();k(this.dom.clear).remove();if(1>this.s.criteria.length)this.s.isChild||(k(this.dom.container).trigger("dtsb-destroy"),k(this.dom.container).css("margin-left",0));else{var a=k(this.dom.container).height()-1;k(this.dom.clear).height("0px");k(this.dom.logicContainer).append(this.dom.clear).width(a);k(this.dom.container).prepend(this.dom.logicContainer);this._setLogicListener();k(this.dom.container).css("margin-left",
|
|
k(this.dom.logicContainer).outerHeight(!0));a=k(this.dom.logicContainer).offset();var b=a.left,d=k(this.dom.container).offset().left;b=b-(b-d)-k(this.dom.logicContainer).outerHeight(!0);k(this.dom.logicContainer).offset({left:b});b=k(this.dom.logicContainer).next();a=a.top;b=k(b).offset().top;a-=a-b;k(this.dom.logicContainer).offset({top:a});k(this.dom.clear).outerHeight(k(this.dom.logicContainer).height());this._setClearListener()}};c.prototype.setListeners=function(){var a=this;k(this.dom.add).unbind("click");
|
|
k(this.dom.add).on("click",function(){a.s.isChild||k(a.dom.container).prepend(a.dom.logicContainer);a.addCriteria();k(a.dom.container).trigger("dtsb-add");a.s.dt.state.save();return!1});for(var b=0,d=this.s.criteria;b<d.length;b++)d[b].criteria.setListeners();this._setClearListener();this._setLogicListener()};c.prototype.addCriteria=function(a,b){void 0===a&&(a=null);void 0===b&&(b=!0);var d=null===a?this.s.criteria.length:a.s.index,e=new n(this.s.dt,this.s.opts,this.s.topGroup,d,this.s.depth);null!==
|
|
a&&(e.c=a.c,e.s=a.s,e.s.depth=this.s.depth,e.classes=a.classes);e.populate();a=!1;for(var g=0;g<this.s.criteria.length;g++)0===g&&this.s.criteria[g].criteria.s.index>e.s.index?(k(e.getNode()).insertBefore(this.s.criteria[g].criteria.dom.container),a=!0):g<this.s.criteria.length-1&&this.s.criteria[g].criteria.s.index<e.s.index&&this.s.criteria[g+1].criteria.s.index>e.s.index&&(k(e.getNode()).insertAfter(this.s.criteria[g].criteria.dom.container),a=!0);a||k(e.getNode()).insertBefore(this.dom.add);this.s.criteria.push({criteria:e,
|
|
index:d});this.s.criteria=this.s.criteria.sort(function(h,m){return h.criteria.s.index-m.criteria.s.index});d=0;for(a=this.s.criteria;d<a.length;d++)g=a[d],g.criteria instanceof n&&g.criteria.updateArrows(1<this.s.criteria.length,b);this._setCriteriaListeners(e);e.setListeners();this.setupLogic()};c.prototype.checkFilled=function(){for(var a=0,b=this.s.criteria;a<b.length;a++){var d=b[a];if(d.criteria instanceof n&&d.criteria.s.filled||d.criteria instanceof c&&d.criteria.checkFilled())return!0}return!1};
|
|
c.prototype.count=function(){for(var a=0,b=0,d=this.s.criteria;b<d.length;b++){var e=d[b];e.criteria instanceof c?a+=e.criteria.count():a++}return a};c.prototype._addPrevGroup=function(a){var b=this.s.criteria.length,d=new c(this.s.dt,this.c,this.s.topGroup,b,!0,this.s.depth+1);this.s.criteria.push({criteria:d,index:b,logic:d.s.logic});d.rebuild(a);this.s.criteria[b].criteria=d;k(this.s.topGroup).trigger("dtsb-redrawContents");this._setGroupListeners(d)};c.prototype._addPrevCriteria=function(a){var b=
|
|
this.s.criteria.length,d=new n(this.s.dt,this.s.opts,this.s.topGroup,b,this.s.depth);d.populate();this.s.criteria.push({criteria:d,index:b});d.rebuild(a);this.s.criteria[b].criteria=d;k(this.s.topGroup).trigger("dtsb-redrawContents")};c.prototype._andSearch=function(a,b){if(0===this.s.criteria.length)return!0;for(var d=0,e=this.s.criteria;d<e.length;d++){var g=e[d];if(!(g.criteria instanceof n&&!g.criteria.s.filled||g.criteria.search(a,b)))return!1}return!0};c.prototype._orSearch=function(a,b){if(0===
|
|
this.s.criteria.length)return!0;for(var d=!1,e=0,g=this.s.criteria;e<g.length;e++){var h=g[e];if(h.criteria instanceof n&&h.criteria.s.filled){if(d=!0,h.criteria.search(a,b))return!0}else if(h.criteria instanceof c&&h.criteria.checkFilled()&&(d=!0,h.criteria.search(a,b)))return!0}return!d};c.prototype._removeCriteria=function(a,b){void 0===b&&(b=!1);if(1>=this.s.criteria.length&&this.s.isChild)this.destroy();else{for(var d=void 0,e=0;e<this.s.criteria.length;e++)this.s.criteria[e].index===a.s.index&&
|
|
(!b||this.s.criteria[e].criteria instanceof c)&&(d=e);void 0!==d&&this.s.criteria.splice(d,1);for(e=0;e<this.s.criteria.length;e++)this.s.criteria[e].index=e,this.s.criteria[e].criteria.s.index=e}};c.prototype._setCriteriaListeners=function(a){var b=this;k(a.dom["delete"]).unbind("click").on("click",function(){b._removeCriteria(a);k(a.dom.container).remove();for(var d=0,e=b.s.criteria;d<e.length;d++){var g=e[d];g.criteria instanceof n&&g.criteria.updateArrows(1<b.s.criteria.length)}a.destroy();b.s.dt.draw();
|
|
k(b.s.topGroup).trigger("dtsb-redrawContents");k(b.s.topGroup).trigger("dtsb-updateTitle");return!1});k(a.dom.right).unbind("click").on("click",function(){var d=a.s.index,e=new c(b.s.dt,b.s.opts,b.s.topGroup,a.s.index,!0,b.s.depth+1);e.addCriteria(a);b.s.criteria[d].criteria=e;b.s.criteria[d].logic="AND";k(b.s.topGroup).trigger("dtsb-redrawContents");b._setGroupListeners(e);return!1});k(a.dom.left).unbind("click").on("click",function(){b.s.toDrop=new n(b.s.dt,b.s.opts,b.s.topGroup,a.s.index);b.s.toDrop.s=
|
|
a.s;b.s.toDrop.c=a.c;b.s.toDrop.classes=a.classes;b.s.toDrop.populate();var d=b.s.toDrop.s.index;k(b.dom.container).trigger("dtsb-dropCriteria");a.s.index=d;b._removeCriteria(a);k(b.s.topGroup).trigger("dtsb-redrawContents");b.s.dt.draw();return!1})};c.prototype._setClearListener=function(){var a=this;k(this.dom.clear).unbind("click").on("click",function(){if(!a.s.isChild)return k(a.dom.container).trigger("dtsb-clearContents"),!1;a.destroy();k(a.s.topGroup).trigger("dtsb-updateTitle");k(a.s.topGroup).trigger("dtsb-redrawContents");
|
|
return!1})};c.prototype._setGroupListeners=function(a){var b=this;k(a.dom.add).unbind("click").on("click",function(){b.setupLogic();k(b.dom.container).trigger("dtsb-add");return!1});k(a.dom.container).unbind("dtsb-add").on("dtsb-add",function(){b.setupLogic();k(b.dom.container).trigger("dtsb-add");return!1});k(a.dom.container).unbind("dtsb-destroy").on("dtsb-destroy",function(){b._removeCriteria(a,!0);k(a.dom.container).remove();b.setupLogic();return!1});k(a.dom.container).unbind("dtsb-dropCriteria").on("dtsb-dropCriteria",
|
|
function(){var d=a.s.toDrop;d.s.index=a.s.index;d.updateArrows(1<b.s.criteria.length,!1);b.addCriteria(d,!1);return!1});a.setListeners()};c.prototype._setup=function(){this.setListeners();k(this.dom.add).text(this.s.dt.i18n("searchBuilder.add",this.c.i18n.add));k(this.dom.logic).text("OR"===this.c.logic?this.s.dt.i18n("searchBuilder.logicOr",this.c.i18n.logicOr):this.s.dt.i18n("searchBuilder.logicAnd",this.c.i18n.logicAnd));this.s.logic="OR"===this.c.logic?"OR":"AND";this.c.greyscale&&k(this.dom.logic).addClass(this.classes.greyscale);
|
|
k(this.dom.logicContainer).append(this.dom.logic).append(this.dom.clear);this.s.isChild&&k(this.dom.container).append(this.dom.logicContainer);k(this.dom.container).append(this.dom.add)};c.prototype._setLogicListener=function(){var a=this;k(this.dom.logic).unbind("click").on("click",function(){a._toggleLogic();a.s.dt.draw();for(var b=0,d=a.s.criteria;b<d.length;b++)d[b].criteria.setListeners()})};c.prototype._toggleLogic=function(){"OR"===this.s.logic?(this.s.logic="AND",k(this.dom.logic).text(this.s.dt.i18n("searchBuilder.logicAnd",
|
|
this.c.i18n.logicAnd))):"AND"===this.s.logic&&(this.s.logic="OR",k(this.dom.logic).text(this.s.dt.i18n("searchBuilder.logicOr",this.c.i18n.logicOr)))};c.version="1.1.0";c.classes={add:"dtsb-add",button:"dtsb-button",clearGroup:"dtsb-clearGroup",greyscale:"dtsb-greyscale",group:"dtsb-group",inputButton:"dtsb-iptbtn",logic:"dtsb-logic",logicContainer:"dtsb-logicContainer"};c.defaults={columns:!0,conditions:{date:n.dateConditions,html:n.stringConditions,"html-num":n.numConditions,"html-num-fmt":n.numFmtConditions,
|
|
luxon:n.luxonDateConditions,moment:n.momentDateConditions,num:n.numConditions,"num-fmt":n.numFmtConditions,string:n.stringConditions},depthLimit:!1,enterSearch:!1,filterChanged:void 0,greyscale:!1,i18n:{add:"Add Condition",button:{0:"Search Builder",_:"Search Builder (%d)"},clearAll:"Clear All",condition:"Condition",data:"Data",deleteTitle:"Delete filtering rule",leftTitle:"Outdent criteria",logicAnd:"And",logicOr:"Or",rightTitle:"Indent criteria",title:{0:"Custom Search Builder",_:"Custom Search Builder (%d)"},
|
|
value:"Value",valueJoiner:"and"},logic:"AND",orthogonal:{display:"display",search:"filter"},preDefined:!1};return c}(),l,z,F=function(){function c(a,b){var d=this;if(!z||!z.versionCheck||!z.versionCheck("1.10.0"))throw Error("SearchBuilder requires DataTables 1.10 or newer");a=new z.Api(a);this.classes=l.extend(!0,{},c.classes);this.c=l.extend(!0,{},c.defaults,b);this.dom={clearAll:l('<button type="button">'+a.i18n("searchBuilder.clearAll",this.c.i18n.clearAll)+"</button>").addClass(this.classes.clearAll).addClass(this.classes.button).attr("type",
|
|
"button"),container:l("<div/>").addClass(this.classes.container),title:l("<div/>").addClass(this.classes.title),titleRow:l("<div/>").addClass(this.classes.titleRow),topGroup:void 0};this.s={dt:a,opts:b,search:void 0,topGroup:void 0};if(void 0===a.settings()[0]._searchBuilder){a.settings()[0]._searchBuilder=this;if(this.s.dt.settings()[0]._bInitComplete)this._setUp();else a.one("init.dt",function(){d._setUp()});return this}}c.prototype.getDetails=function(){return this.s.topGroup.getDetails()};c.prototype.getNode=
|
|
function(){return this.dom.container};c.prototype.rebuild=function(a){l(this.dom.clearAll).click();if(void 0===a||null===a)return this;this.s.topGroup.rebuild(a);this.s.dt.draw();this.s.topGroup.setListeners();return this};c.prototype._applyPreDefDefaults=function(a){var b=this;void 0!==a.criteria&&void 0===a.logic&&(a.logic="AND");for(var d=function(m){void 0!==m.criteria?m=e._applyPreDefDefaults(m):e.s.dt.columns().every(function(p){b.s.dt.settings()[0].aoColumns[p].sTitle===m.data&&(m.dataIdx=
|
|
p)})},e=this,g=0,h=a.criteria;g<h.length;g++)d(h[g]);return a};c.prototype._setUp=function(a){var b=this;void 0===a&&(a=!0);l.fn.DataTable.Api.registerPlural("columns().type()","column().type()",function(m,p){return this.iterator("column",function(q,y){return q.aoColumns[y].sType},1)});if(!z.DateTime){var d=this.s.dt.columns().type().toArray(),e=this.s.dt.columns().toArray();void 0===d&&(this.s.dt.draw(),d=this.s.dt.columns().type().toArray());for(var g=0;g<e[0].length;g++){var h=d[e[0][g]];if((!0===
|
|
this.c.columns||Array.isArray(this.c.columns)&&-1!==this.c.columns.indexOf(g))&&(-1!==h.indexOf("date")||-1!==h.indexOf("moment")||-1!==h.indexOf("luxon")))throw alert("SearchBuilder Requires DateTime when used with dates."),Error("SearchBuilder requires DateTime");}}this.s.topGroup=new D(this.s.dt,this.c,void 0);this._setClearListener();this.s.dt.on("stateSaveParams",function(m,p,q){q.searchBuilder=b.getDetails();q.page=b.s.dt.page()});this._build();a&&(a=this.s.dt.state.loaded(),null!==a&&void 0!==
|
|
a.searchBuilder?(this.s.topGroup.rebuild(a.searchBuilder),l(this.s.topGroup.dom.container).trigger("dtsb-redrawContents"),this.s.dt.page(a.page).draw("page"),this.s.topGroup.setListeners()):!1!==this.c.preDefined&&(this.c.preDefined=this._applyPreDefDefaults(this.c.preDefined),this.rebuild(this.c.preDefined)));this._setEmptyListener();this.s.dt.state.save()};c.prototype._updateTitle=function(a){l(this.dom.title).html(this.s.dt.i18n("searchBuilder.title",this.c.i18n.title,a))};c.prototype._build=function(){var a=
|
|
this;l(this.dom.clearAll).remove();l(this.dom.container).empty();var b=this.s.topGroup.count();this._updateTitle(b);l(this.dom.titleRow).append(this.dom.title);l(this.dom.container).append(this.dom.titleRow);this.dom.topGroup=this.s.topGroup.getNode();l(this.dom.container).append(this.dom.topGroup);this._setRedrawListener();var d=this.s.dt.table(0).node();-1===l.fn.dataTable.ext.search.indexOf(this.s.search)&&(this.s.search=function(e,g,h,m){return e.nTable!==d?!0:a.s.topGroup.search(g,h)},l.fn.dataTable.ext.search.push(this.s.search));
|
|
this.s.dt.on("destroy.dt",function(){l(a.dom.container).remove();l(a.dom.clearAll).remove();for(var e=l.fn.dataTable.ext.search.indexOf(a.s.search);-1!==e;)l.fn.dataTable.ext.search.splice(e,1),e=l.fn.dataTable.ext.search.indexOf(a.s.search)})};c.prototype._checkClear=function(){0<this.s.topGroup.s.criteria.length?(l(this.dom.clearAll).insertAfter(this.dom.title),this._setClearListener()):l(this.dom.clearAll).remove()};c.prototype._filterChanged=function(a){var b=this.c.filterChanged;"function"===
|
|
typeof b&&b(a,this.s.dt.i18n("searchBuilder.button",this.c.i18n.button,a))};c.prototype._setClearListener=function(){var a=this;l(this.dom.clearAll).unbind("click");l(this.dom.clearAll).on("click",function(){a.s.topGroup=new D(a.s.dt,a.c,void 0);a._build();a.s.dt.draw();a.s.topGroup.setListeners();l(a.dom.clearAll).remove();a._setEmptyListener();a._filterChanged(0);return!1})};c.prototype._setRedrawListener=function(){var a=this;l(this.s.topGroup.dom.container).unbind("dtsb-redrawContents");l(this.s.topGroup.dom.container).on("dtsb-redrawContents",
|
|
function(){a._checkClear();a.s.topGroup.redrawContents();a.s.topGroup.setupLogic();a._setEmptyListener();var b=a.s.topGroup.count();a._updateTitle(b);a._filterChanged(b);a.s.dt.state.save()});l(this.s.topGroup.dom.container).unbind("dtsb-redrawLogic");l(this.s.topGroup.dom.container).on("dtsb-redrawLogic",function(){a.s.topGroup.redrawLogic();var b=a.s.topGroup.count();a._updateTitle(b);a._filterChanged(b)});l(this.s.topGroup.dom.container).on("dtsb-add",function(){var b=a.s.topGroup.count();a._updateTitle(b);
|
|
a._filterChanged(b)});l(this.s.dt).on("postEdit postCreate postRemove",function(){a.s.topGroup.redrawContents()});l(this.s.topGroup.dom.container).unbind("dtsb-clearContents");l(this.s.topGroup.dom.container).on("dtsb-clearContents",function(){a._setUp(!1);a._filterChanged(0);a.s.dt.draw()});l(this.s.topGroup.dom.container).on("dtsb-updateTitle",function(){var b=a.s.topGroup.count();a._updateTitle(b);a._filterChanged(b)})};c.prototype._setEmptyListener=function(){var a=this;l(this.s.topGroup.dom.add).on("click",
|
|
function(){a._checkClear()});l(this.s.topGroup.dom.container).on("dtsb-destroy",function(){l(a.dom.clearAll).remove()})};c.version="1.1.0";c.classes={button:"dtsb-button",clearAll:"dtsb-clearAll",container:"dtsb-searchBuilder",inputButton:"dtsb-iptbtn",title:"dtsb-title",titleRow:"dtsb-titleRow"};c.defaults={columns:!0,conditions:{date:n.dateConditions,html:n.stringConditions,"html-num":n.numConditions,"html-num-fmt":n.numFmtConditions,luxon:n.luxonDateConditions,moment:n.momentDateConditions,num:n.numConditions,
|
|
"num-fmt":n.numFmtConditions,string:n.stringConditions},depthLimit:!1,enterSearch:!1,filterChanged:void 0,greyscale:!1,i18n:{add:"Add Condition",button:{0:"Search Builder",_:"Search Builder (%d)"},clearAll:"Clear All",condition:"Condition",conditions:{array:{contains:"Contains",empty:"Empty",equals:"Equals",not:"Not",notEmpty:"Not Empty",without:"Without"},date:{after:"After",before:"Before",between:"Between",empty:"Empty",equals:"Equals",not:"Not",notBetween:"Not Between",notEmpty:"Not Empty"},number:{between:"Between",
|
|
empty:"Empty",equals:"Equals",gt:"Greater Than",gte:"Greater Than Equal To",lt:"Less Than",lte:"Less Than Equal To",not:"Not",notBetween:"Not Between",notEmpty:"Not Empty"},string:{contains:"Contains",empty:"Empty",endsWith:"Ends With",equals:"Equals",not:"Not",notEmpty:"Not Empty",startsWith:"Starts With"}},data:"Data",deleteTitle:"Delete filtering rule",leftTitle:"Outdent criteria",logicAnd:"And",logicOr:"Or",rightTitle:"Indent criteria",title:{0:"Custom Search Builder",_:"Custom Search Builder (%d)"},
|
|
value:"Value",valueJoiner:"and"},logic:"AND",orthogonal:{display:"display",search:"filter"},preDefined:!1};return c}();(function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return c(a,window,document)}):"object"===typeof exports?module.exports=function(a,b){a||(a=window);b&&b.fn.dataTable||(b=require("datatables.net")(a,b).$);return c(b,a,a.document)}:c(window.jQuery,window,document)})(function(c,a,b){function d(g,h){g=new e.Api(g);h=h?h:g.init().searchBuilder||
|
|
e.defaults.searchBuilder;return(new F(g,h)).getNode()}J(c);I(c);H(c);var e=c.fn.dataTable;c.fn.dataTable.SearchBuilder=F;c.fn.DataTable.SearchBuilder=F;c.fn.dataTable.Group=D;c.fn.DataTable.Group=D;c.fn.dataTable.Criteria=n;c.fn.DataTable.Criteria=n;a=c.fn.dataTable.Api.register;c.fn.dataTable.ext.searchBuilder={conditions:{}};c.fn.dataTable.ext.buttons.searchBuilder={action:function(g,h,m,p){g.stopPropagation();this.popover(p._searchBuilder.getNode(),{align:"dt-container"});void 0!==p._searchBuilder.s.topGroup&&
|
|
p._searchBuilder.s.topGroup.dom.container.trigger("dtsb-redrawContents")},config:{},init:function(g,h,m){var p=new c.fn.dataTable.SearchBuilder(g,c.extend({filterChanged:function(q,y){g.button(h).text(y)}},m.config));g.button(h).text(m.text||g.i18n("searchBuilder.button",p.c.i18n.button,0));m._searchBuilder=p},text:null};a("searchBuilder.getDetails()",function(){var g=this.context[0];return g._searchBuilder?g._searchBuilder.getDetails():null});a("searchBuilder.rebuild()",function(g){var h=this.context[0];
|
|
if(void 0===h._searchBuilder)return null;h._searchBuilder.rebuild(g);return this});a("searchBuilder.container()",function(){var g=this.context[0];return g._searchBuilder?g._searchBuilder.getNode():null});c(b).on("preInit.dt.dtsp",function(g,h,m){"dt"===g.namespace&&(h.oInit.searchBuilder||e.defaults.searchBuilder)&&(h._searchBuilder||d(h))});e.ext.feature.push({cFeature:"Q",fnInit:d});e.ext.features&&e.ext.features.register("searchBuilder",d)})})();
|