diff --git a/LICENSE.md b/LICENSE.md index 6bf0d97..ae4c650 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Olivier Giulieri +Copyright (c) 2020 Olivier Giulieri Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 4cd8b8e..ff6a4a9 100644 --- a/README.md +++ b/README.md @@ -448,7 +448,7 @@ A re-write for React in under construction at [Structured-Filter-React](https:// ## License -Copyright (c) 2019 [Olivier Giulieri](https://evoluteur.github.io/). +Copyright (c) 2020 [Olivier Giulieri](https://evoluteur.github.io/). Structured-Filter is released under the [MIT license](https://github.com/evoluteur/structured-filter/blob/master/LICENSE.md#structured-filter). diff --git a/bower.json b/bower.json index 20ede5d..7bb9388 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "structured-filter", - "version": "2.0.3", + "version": "2.0.4", "description": "jQuery UI widget for structured queries", "homepage": "http://evoluteur.github.io/structured-filter/", "main": [ @@ -8,10 +8,10 @@ "less/structured-filter.less" ], "license": "MIT", - "copyright": "(c) 2019 Olivier Giulieri", + "copyright": "(c) 2020 Olivier Giulieri", "authors": "Olivier Giulieri (https://evoluteur.github.io/)", "dependencies": { - "jquery": "~3.4.1", + "jquery": "~3.5.1", "jquery-ui": "^1.12.1" }, "ignore": [ diff --git a/css/structured-filter.css b/css/structured-filter.css index 27d6c7b..d88e7b4 100644 --- a/css/structured-filter.css +++ b/css/structured-filter.css @@ -1,7 +1,7 @@ /* - structured-filter 2.0.3 + structured-filter 2.0.4 http://evoluteur.github.io/structured-filter/ - (c) 2019 Olivier Giulieri + (c) 2020 Olivier Giulieri */ .structFilter { min-height: 20px; diff --git a/index.html b/index.html index b5b2167..439f549 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ - + @@ -24,7 +24,7 @@

Structured-Filter

-

Structured-Filter (currently v2.0.3) is a Web UI for building structured search queries. It is a full jQuery UI widget, supporting various configurations and themes. +

Structured-Filter (currently v2.0.4) is a Web UI for building structured search queries. It is a full jQuery UI widget, supporting various configurations and themes.

@@ -68,7 +68,7 @@

Structured-Filter

Structured-Filter is released under the MIT license.

-

© 2019 Olivier Giulieri

+

© 2020 Olivier Giulieri



diff --git a/js/structured-filter.js b/js/structured-filter.js index 37a692a..5ae8ba7 100644 --- a/js/structured-filter.js +++ b/js/structured-filter.js @@ -1,7 +1,7 @@ /*! - * structured-filter 2.0.3 + * structured-filter 2.0.4 * - * (c) 2019 Olivier Giulieri + * (c) 2020 Olivier Giulieri * * https://github.com/evoluteur/structured-filter * @@ -437,7 +437,7 @@ $.widget( 'evol.structFilter', { break; case fTypes.list: h+=''+ - ((fld.list.length>7)?'() ':'')+ + ((fld.list.length>7)?'() ':'')+ EvoUI.inputCheckboxes(fld.list)+ ''; break; @@ -459,15 +459,15 @@ $.widget( 'evol.structFilter', { case fTypes.time: case fTypes.number: var iType=(fType==fTypes.date)?'text':fType; - h+=''; + h+=''; if(opBetween){ h+=''+i18n.opAnd+' '+ - ''; + ''; } addOK=false; break; default: - h+=''; + h+=''; addOK=false; } editor.append(h); @@ -697,7 +697,7 @@ var EvoUI={ }, inputHidden:function(id,val){ - return ''; + return ''; }, inputOption:function(fID,fV){ @@ -708,7 +708,7 @@ var EvoUI={ inputCheckboxes:function(fLOV){ return fLOV.map(function(lv){ - return ''+ + return ''+ ' '; }).join(''); } diff --git a/js/structured-filter.min.js b/js/structured-filter.min.js index 7244117..c33d7ca 100644 --- a/js/structured-filter.min.js +++ b/js/structured-filter.min.js @@ -1,6 +1,6 @@ /* - structured-filter 2.0.3 + structured-filter 2.0.4 http://evoluteur.github.io/structured-filter/ - (c) 2019 Olivier Giulieri + (c) 2020 Olivier Giulieri */ -!function(a,b){var c={text:"text",bool:"boolean",number:"number",date:"date",time:"time",list:"list",listOpts:"list-options",listDropdown:"list-dropdown"},d={sEqual:"equals",sNotEqual:"not equal",sStart:"starts with",sContain:"contains",sNotContain:"doesn't contain",sFinish:"finishes with",sInList:"any of",sIsNull:"is empty",sIsNotNull:"is not empty",sBefore:"before",sAfter:"after",sNumEqual:"=",sNumNotEqual:"!=",sGreater:">",sSmaller:"<",sOn:"on",sNotOn:"not on",sAt:"at",sNotAt:"not at",sBetween:"between",sNotBetween:"not between",opAnd:"and",yes:"Yes",no:"No",bNewCond:"New filter condition",bAddCond:"Add condition",bUpdateCond:"Update condition",bSubmit:"Submit",bCancel:"Cancel"},e={sEqual:"eq",sNotEqual:"ne",sStart:"sw",sContain:"ct",sNotContain:"nct",sFinish:"fw",sInList:"in",sIsNull:"null",sIsNotNull:"nn",sGreater:"gt",sSmaller:"lt",sBetween:"bw",sNotBetween:"nbw"},f=navigator.userAgent.toLowerCase().indexOf("firefox")===-1;a.widget("evol.structFilter",{options:{fields:[],dateFormat:"mm/dd/yy",highlight:!0,buttonLabels:!1,submitButton:!1,submitReady:!1,disableOperators:!1},_create:function(){var b=this.options.buttonLabels,f=this,g=this.element,h=function(a,b,c){return'"},i='
'+h("evo-bNew",d.bNewCond);this.options.submitButton&&(i+=h("evo-bSubmit",d.bSubmit)),i+='
'+h("evo-bAdd",d.bAddCond,!0)+h("evo-bDel",d.bCancel,!0),this._step=0,g.addClass("structFilter ui-widget-content ui-corner-all").html(i),this.options.submitReady&&(this._hValues=a("").appendTo(g)),this.options.submitButton&&(this._bSubmit=g.find(".evo-bSubmit").button({showLabel:b}).on("click",function(a){f.element.trigger("submit.search")})),this._bNew=g.find(".evo-bNew").button({showLabel:b,icon:"ui-icon-plusthick",iconPosition:"end"}).on("click",function(a){f._step<1&&(f._setEditorField(),f._step=1),f._bAdd.find(".ui-button-text").html(d.bAddCond)}),this._bAdd=g.find(".evo-bAdd").button({showLabel:b,icon:"ui-icon-check",iconPosition:"end"}).on("click",function(a){var b=f._getEditorData();f._cFilter?f._enableFilter(b,f.options.highlight):f.addCondition(b),f._removeEditor()}),this._bDel=g.find(".evo-bDel").button({showLabel:b,icon:"ui-icon-close",iconPosition:"end"}).on("click",function(a){f._removeEditor()}),this._editor=g.find(".evo-editFilter").on("change","#field",function(b){b.stopPropagation(),f._step>2&&f._editor.find("#value,#value2,.as-Txt").remove(),f._step>1&&(f._editor.find("#operator").remove(),f._bAdd.hide()),f._step=1;var d=a(b.currentTarget).val();if(""!==d){f._field=f._getFieldById(d);var e=f._type=f._field.type;f._setEditorOperator(),(e===c.bool||e.startsWith("list"))&&f._setEditorValue()}else f._field=f._type=null}).on("change","#operator",function(b){b.stopPropagation(),f._operator=a(this).val(),f._step>2&&(f._editor.find("#value,#value2,.as-Txt").remove(),f._bAdd.hide(),f._step=2),f._setEditorValue()}).on("change keyup","#value,#value2",function(b){b.stopPropagation();var d=f._type,g=a(this).val(),h=""!==g||d===c.bool||d.startsWith("list");d==c.number?h=h&&!isNaN(g):f._operator!=e.sBetween&&f._operator!=e.sNotBetween||(h=""!==f._editor.find("#value").val()&&""!==f._editor.find("#value2").val()),h?(f._bAdd.button("enable"),13==b.which&&f._bAdd.trigger("click")):f._bAdd.button("disable")}).on("click","#checkAll",function(){var b=a(this),c=b.prop("checked");allChecks=b.siblings().prop("checked",c)}),this._filters=g.find(".evo-searchFilters").on("click","a",function(){f._editFilter(a(this))}).on("click","a .ui-button-icon",function(b){b.stopPropagation();var c=a(this).parent();c.hasClass("ui-state-disabled")||c.fadeOut("slow",function(){c.remove(),f._triggerChange()})})},_getFieldById:function(a){if(!this._hash){this._hash={};for(var b=this.options.fields,c=0,d=b.length;c'+this._htmlFilter(b)+"").prependTo(this._filters).button({icon:"ui-icon-close",iconPosition:"end"}).data("filter",b).fadeIn();return this.options.highlight&&c.effect("highlight"),this._triggerChange(),this._bSubmit&&this._bSubmit.removeClass("ui-state-active").show(),this},removeCondition:function(a){return this._filters.children().eq(a).remove(),this._triggerChange(),this},_htmlFilter:function(a){var b=''+a.field.label+' '+a.operator.label+' '+a.value.label+"";return a.operator.value!=e.sBetween&&a.operator.value!=e.sNotBetween||(b+=' '+d.opAnd+' '+a.value.label2+""),b},_enableFilter:function(a,b){this._cFilter&&(this._cFilter.button("enable").removeClass("ui-state-hover ui-state-active"),b&&this._cFilter.effect("highlight"),a?(this._cFilter.data("filter",a).find(":first-child").html(this._htmlFilter(a)),this._cFilter=null,this._triggerChange()):this._cFilter=null)},_editFilter:function(a){var b=a.data("filter"),c=b.field.value,f=b.operator.value,g=b.value;this._enableFilter(null,!1),this._removeEditor(),this._cFilter=a.button("disable"),this._setEditorField(c),this._setEditorOperator(f),f==e.sBetween||f==e.sNotBetween?this._setEditorValue(g.value,g.value2):this._setEditorValue(g.value),this._bAdd.find(".ui-button-text").html(d.bUpdateCond),this._step=3},_setEditorField:function(b){if(this._step<1){if(this._bNew.stop().hide(),this._bSubmit&&this._bSubmit.stop().hide(),this._bDel.show(),!this._fList){var c='",this._fList=c}a(this._fList).appendTo(this._editor).focus()}b&&(this._field=this._getFieldById(b),this._type=this._field.type,this._editor.find("#field").val(b)),this._step=1},_setEditorOperator:function(a){if(this.options.disableOperators)return this._step=2,this._setEditorValue();var b=this._type;if(this._step<2){var f="",h=g.inputOption;switch(b){case c.list:f+=g.inputHidden("operator",e.sInList),this._operator=e.sInList;break;case c.listOpts:case c.listDropdown:case c.bool:f+=g.inputHidden("operator",e.sEqual),this._operator=e.sEqual;break;default:switch(f+='"}this._editor.append(f)}a&&b!=c.list&&(this._editor.find("#operator").val(a),this._operator=a),this._step=2},_setEditorValue:function(a,b){var f=this._editor,h=this._field,i=this._type,j=f.find("#operator").val(),k=!1,l=!0;if(""!==j){if(i==c.list||j!=e.sIsNull&&j!=e.sIsNotNull){if(this._step<3){var m="";switch(k=j==e.sBetween||j==e.sNotBetween,i){case c.bool:m+=''+g.inputRadio("value","1",d.yes,"0"!=a,"value1")+g.inputRadio("value","0",d.no,"0"==a,"value0")+"";break;case c.list:m+=''+(h.list.length>7?'() ':"")+g.inputCheckboxes(h.list)+"";break;case c.listOpts:m+='',m+=h.list.map(function(b){return g.inputRadio(h.id,b.id,b.label,a==b.id,"value"+b.id)}).join(""),m+="";break;case c.listDropdown:m+='";break;case c.date:case c.time:case c.number:var n=i==c.date?"text":i;m+='',k&&(m+=''+d.opAnd+' '),l=!1;break;default:m+='',l=!1}f.append(m),i==c.date&&f.find("#value,#value2").datepicker({dateFormat:this.options.dateFormat})}if(a){var o=f.find("#value");switch(i){case c.list:o.find("#"+a.split(",").join(",#")).prop("checked","checked");break;case c.listOpts:case c.bool:o.find("#value"+a).prop("checked","checked");break;default:o.val(a),l=""!==a,k&&(o.next().next().val(b),l=""!==a&&""!==b)}}else l=i==c.list||i==c.listDropdown||i==c.bool}else f.append(g.inputHidden("value",""));this._bAdd.button(l?"enable":"disable").show(),this._step=3}},_getEditorData:function(){var a=this._editor,b=a.find("#field"),f=a.find("#value"),g={field:{label:b.find("option:selected").text(),value:b.val()},operator:{},value:{}},h=g.operator,i=g.value;if(this._type==c.list){var j=[],k=[];f.find("input:checked").not("#checkAll").each(function(){j.push(this.value),k.push(this.nextSibling.innerHTML)}),0===j.length?(h.label=d.sIsNull,h.value=e.sIsNull,i.label=i.value=""):1==j.length?(h.label=d.sEqual,h.value=e.sEqual,i.label='"'+k[0]+'"',i.value=j[0]):(h.label=d.sInList,h.value=e.sInList,i.label="("+k.join(", ")+")",i.value=j.join(","))}else if(this._type==c.bool){h.label=d.sEqual,h.value=e.sEqual;var l=f.find("#value1").prop("checked")?1:0;i.label=1==l?d.yes:d.no,i.value=l}else if(this._type==c.listOpts){h.label=d.sEqual,h.value=e.sEqual;var m=f.find("input:checked");i.label=m.parent().text(),i.value=m.prop("id").slice(5)}else if(this._type==c.listDropdown){h.label=d.sEqual,h.value=e.sEqual;var n=f.val();i.label=n?f.find("option[value="+n+"]").text():d.sIsNull,i.value=f.val()}else{var o=a.find("#operator"),p=o.val();h.label=o.find("option:selected").text(),h.value=p,p==e.sIsNull||p==e.sIsNotNull?i.label=i.value="":(this._type==c.number||this._type==c.date||this._type==c.time?i.label=f.val():i.label='"'+f.val()+'"',i.value=f.val(),p!=e.sBetween&&p!=e.sNotBetween||(i.label2=i.value2=f.next().next().val()))}return g},_hiddenValue:function(a,b,c){a.push(g.inputHidden("fld-"+c,b.field.value)+g.inputHidden("op-"+c,b.operator.value)+g.inputHidden("val-"+c,b.value.value));var d=b.value.value2;d&&a.push(g.inputHidden("val2-"+c,d))},_setHiddenValues:function(){for(var a=this.val(),b=a.length,c=[g.inputHidden("elem",b)],d=0;d'+c+" "},inputHidden:function(a,b){return''},inputOption:function(a,b){return'"},optNull:'',inputCheckboxes:function(a){return a.map(function(a){return' "}).join("")}}}(jQuery); \ No newline at end of file +!function(a,b){var c={text:"text",bool:"boolean",number:"number",date:"date",time:"time",list:"list",listOpts:"list-options",listDropdown:"list-dropdown"},d={sEqual:"equals",sNotEqual:"not equal",sStart:"starts with",sContain:"contains",sNotContain:"doesn't contain",sFinish:"finishes with",sInList:"any of",sIsNull:"is empty",sIsNotNull:"is not empty",sBefore:"before",sAfter:"after",sNumEqual:"=",sNumNotEqual:"!=",sGreater:">",sSmaller:"<",sOn:"on",sNotOn:"not on",sAt:"at",sNotAt:"not at",sBetween:"between",sNotBetween:"not between",opAnd:"and",yes:"Yes",no:"No",bNewCond:"New filter condition",bAddCond:"Add condition",bUpdateCond:"Update condition",bSubmit:"Submit",bCancel:"Cancel"},e={sEqual:"eq",sNotEqual:"ne",sStart:"sw",sContain:"ct",sNotContain:"nct",sFinish:"fw",sInList:"in",sIsNull:"null",sIsNotNull:"nn",sGreater:"gt",sSmaller:"lt",sBetween:"bw",sNotBetween:"nbw"},f=navigator.userAgent.toLowerCase().indexOf("firefox")===-1;a.widget("evol.structFilter",{options:{fields:[],dateFormat:"mm/dd/yy",highlight:!0,buttonLabels:!1,submitButton:!1,submitReady:!1,disableOperators:!1},_create:function(){var b=this.options.buttonLabels,f=this,g=this.element,h=function(a,b,c){return'"},i='
'+h("evo-bNew",d.bNewCond);this.options.submitButton&&(i+=h("evo-bSubmit",d.bSubmit)),i+='
'+h("evo-bAdd",d.bAddCond,!0)+h("evo-bDel",d.bCancel,!0),this._step=0,g.addClass("structFilter ui-widget-content ui-corner-all").html(i),this.options.submitReady&&(this._hValues=a("").appendTo(g)),this.options.submitButton&&(this._bSubmit=g.find(".evo-bSubmit").button({showLabel:b}).on("click",function(a){f.element.trigger("submit.search")})),this._bNew=g.find(".evo-bNew").button({showLabel:b,icon:"ui-icon-plusthick",iconPosition:"end"}).on("click",function(a){f._step<1&&(f._setEditorField(),f._step=1),f._bAdd.find(".ui-button-text").html(d.bAddCond)}),this._bAdd=g.find(".evo-bAdd").button({showLabel:b,icon:"ui-icon-check",iconPosition:"end"}).on("click",function(a){var b=f._getEditorData();f._cFilter?f._enableFilter(b,f.options.highlight):f.addCondition(b),f._removeEditor()}),this._bDel=g.find(".evo-bDel").button({showLabel:b,icon:"ui-icon-close",iconPosition:"end"}).on("click",function(a){f._removeEditor()}),this._editor=g.find(".evo-editFilter").on("change","#field",function(b){b.stopPropagation(),f._step>2&&f._editor.find("#value,#value2,.as-Txt").remove(),f._step>1&&(f._editor.find("#operator").remove(),f._bAdd.hide()),f._step=1;var d=a(b.currentTarget).val();if(""!==d){f._field=f._getFieldById(d);var e=f._type=f._field.type;f._setEditorOperator(),(e===c.bool||e.startsWith("list"))&&f._setEditorValue()}else f._field=f._type=null}).on("change","#operator",function(b){b.stopPropagation(),f._operator=a(this).val(),f._step>2&&(f._editor.find("#value,#value2,.as-Txt").remove(),f._bAdd.hide(),f._step=2),f._setEditorValue()}).on("change keyup","#value,#value2",function(b){b.stopPropagation();var d=f._type,g=a(this).val(),h=""!==g||d===c.bool||d.startsWith("list");d==c.number?h=h&&!isNaN(g):f._operator!=e.sBetween&&f._operator!=e.sNotBetween||(h=""!==f._editor.find("#value").val()&&""!==f._editor.find("#value2").val()),h?(f._bAdd.button("enable"),13==b.which&&f._bAdd.trigger("click")):f._bAdd.button("disable")}).on("click","#checkAll",function(){var b=a(this),c=b.prop("checked");allChecks=b.siblings().prop("checked",c)}),this._filters=g.find(".evo-searchFilters").on("click","a",function(){f._editFilter(a(this))}).on("click","a .ui-button-icon",function(b){b.stopPropagation();var c=a(this).parent();c.hasClass("ui-state-disabled")||c.fadeOut("slow",function(){c.remove(),f._triggerChange()})})},_getFieldById:function(a){if(!this._hash){this._hash={};for(var b=this.options.fields,c=0,d=b.length;c'+this._htmlFilter(b)+"").prependTo(this._filters).button({icon:"ui-icon-close",iconPosition:"end"}).data("filter",b).fadeIn();return this.options.highlight&&c.effect("highlight"),this._triggerChange(),this._bSubmit&&this._bSubmit.removeClass("ui-state-active").show(),this},removeCondition:function(a){return this._filters.children().eq(a).remove(),this._triggerChange(),this},_htmlFilter:function(a){var b=''+a.field.label+' '+a.operator.label+' '+a.value.label+"";return a.operator.value!=e.sBetween&&a.operator.value!=e.sNotBetween||(b+=' '+d.opAnd+' '+a.value.label2+""),b},_enableFilter:function(a,b){this._cFilter&&(this._cFilter.button("enable").removeClass("ui-state-hover ui-state-active"),b&&this._cFilter.effect("highlight"),a?(this._cFilter.data("filter",a).find(":first-child").html(this._htmlFilter(a)),this._cFilter=null,this._triggerChange()):this._cFilter=null)},_editFilter:function(a){var b=a.data("filter"),c=b.field.value,f=b.operator.value,g=b.value;this._enableFilter(null,!1),this._removeEditor(),this._cFilter=a.button("disable"),this._setEditorField(c),this._setEditorOperator(f),f==e.sBetween||f==e.sNotBetween?this._setEditorValue(g.value,g.value2):this._setEditorValue(g.value),this._bAdd.find(".ui-button-text").html(d.bUpdateCond),this._step=3},_setEditorField:function(b){if(this._step<1){if(this._bNew.stop().hide(),this._bSubmit&&this._bSubmit.stop().hide(),this._bDel.show(),!this._fList){var c='",this._fList=c}a(this._fList).appendTo(this._editor).focus()}b&&(this._field=this._getFieldById(b),this._type=this._field.type,this._editor.find("#field").val(b)),this._step=1},_setEditorOperator:function(a){if(this.options.disableOperators)return this._step=2,this._setEditorValue();var b=this._type;if(this._step<2){var f="",h=g.inputOption;switch(b){case c.list:f+=g.inputHidden("operator",e.sInList),this._operator=e.sInList;break;case c.listOpts:case c.listDropdown:case c.bool:f+=g.inputHidden("operator",e.sEqual),this._operator=e.sEqual;break;default:switch(f+='"}this._editor.append(f)}a&&b!=c.list&&(this._editor.find("#operator").val(a),this._operator=a),this._step=2},_setEditorValue:function(a,b){var f=this._editor,h=this._field,i=this._type,j=f.find("#operator").val(),k=!1,l=!0;if(""!==j){if(i==c.list||j!=e.sIsNull&&j!=e.sIsNotNull){if(this._step<3){var m="";switch(k=j==e.sBetween||j==e.sNotBetween,i){case c.bool:m+=''+g.inputRadio("value","1",d.yes,"0"!=a,"value1")+g.inputRadio("value","0",d.no,"0"==a,"value0")+"";break;case c.list:m+=''+(h.list.length>7?'() ':"")+g.inputCheckboxes(h.list)+"";break;case c.listOpts:m+='',m+=h.list.map(function(b){return g.inputRadio(h.id,b.id,b.label,a==b.id,"value"+b.id)}).join(""),m+="";break;case c.listDropdown:m+='";break;case c.date:case c.time:case c.number:var n=i==c.date?"text":i;m+='',k&&(m+=''+d.opAnd+' '),l=!1;break;default:m+='',l=!1}f.append(m),i==c.date&&f.find("#value,#value2").datepicker({dateFormat:this.options.dateFormat})}if(a){var o=f.find("#value");switch(i){case c.list:o.find("#"+a.split(",").join(",#")).prop("checked","checked");break;case c.listOpts:case c.bool:o.find("#value"+a).prop("checked","checked");break;default:o.val(a),l=""!==a,k&&(o.next().next().val(b),l=""!==a&&""!==b)}}else l=i==c.list||i==c.listDropdown||i==c.bool}else f.append(g.inputHidden("value",""));this._bAdd.button(l?"enable":"disable").show(),this._step=3}},_getEditorData:function(){var a=this._editor,b=a.find("#field"),f=a.find("#value"),g={field:{label:b.find("option:selected").text(),value:b.val()},operator:{},value:{}},h=g.operator,i=g.value;if(this._type==c.list){var j=[],k=[];f.find("input:checked").not("#checkAll").each(function(){j.push(this.value),k.push(this.nextSibling.innerHTML)}),0===j.length?(h.label=d.sIsNull,h.value=e.sIsNull,i.label=i.value=""):1==j.length?(h.label=d.sEqual,h.value=e.sEqual,i.label='"'+k[0]+'"',i.value=j[0]):(h.label=d.sInList,h.value=e.sInList,i.label="("+k.join(", ")+")",i.value=j.join(","))}else if(this._type==c.bool){h.label=d.sEqual,h.value=e.sEqual;var l=f.find("#value1").prop("checked")?1:0;i.label=1==l?d.yes:d.no,i.value=l}else if(this._type==c.listOpts){h.label=d.sEqual,h.value=e.sEqual;var m=f.find("input:checked");i.label=m.parent().text(),i.value=m.prop("id").slice(5)}else if(this._type==c.listDropdown){h.label=d.sEqual,h.value=e.sEqual;var n=f.val();i.label=n?f.find("option[value="+n+"]").text():d.sIsNull,i.value=f.val()}else{var o=a.find("#operator"),p=o.val();h.label=o.find("option:selected").text(),h.value=p,p==e.sIsNull||p==e.sIsNotNull?i.label=i.value="":(this._type==c.number||this._type==c.date||this._type==c.time?i.label=f.val():i.label='"'+f.val()+'"',i.value=f.val(),p!=e.sBetween&&p!=e.sNotBetween||(i.label2=i.value2=f.next().next().val()))}return g},_hiddenValue:function(a,b,c){a.push(g.inputHidden("fld-"+c,b.field.value)+g.inputHidden("op-"+c,b.operator.value)+g.inputHidden("val-"+c,b.value.value));var d=b.value.value2;d&&a.push(g.inputHidden("val2-"+c,d))},_setHiddenValues:function(){for(var a=this.val(),b=a.length,c=[g.inputHidden("elem",b)],d=0;d'+c+" "},inputHidden:function(a,b){return''},inputOption:function(a,b){return'"},optNull:'',inputCheckboxes:function(a){return a.map(function(a){return' "}).join("")}}}(jQuery); \ No newline at end of file diff --git a/less/structured-filter.less b/less/structured-filter.less index 0a136db..99827e9 100644 --- a/less/structured-filter.less +++ b/less/structured-filter.less @@ -1,7 +1,7 @@ // Structured Filter for jQuery UI // https://github.com/evoluteur/structured-filter -// (c) 2019 Olivier Giulieri +// (c) 2020 Olivier Giulieri .border-radius(@r){ border-radius: @r; diff --git a/package.json b/package.json index 033b4ba..3eced6f 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "structured-filter", - "version": "2.0.3", + "version": "2.0.4", "description": "Generic Web UI for building structured search or filter queries. With it you can build structured search conditions like Firstname starts with 'A' and Birthday after 1/1/1990 and State in (CA, NY, FL)...", - "copyright": "(c) 2019 Olivier Giulieri", + "copyright": "(c) 2020 Olivier Giulieri", "homepage": "http://evoluteur.github.io/structured-filter/", "author": "Olivier Giulieri (https://evoluteur.github.io/)", "license": "MIT", @@ -14,7 +14,7 @@ "url": "https://github.com/evoluteur/structured-filter/issues" }, "dependencies": { - "jquery": "~3.4.1", + "jquery": "~3.5.1", "jquery-ui": "^1.12.1" }, "devDependencies": {