diff --git a/js/bootstrap5-toggle.ecmas.js b/js/bootstrap5-toggle.ecmas.js index a153183..2ea8673 100644 --- a/js/bootstrap5-toggle.ecmas.js +++ b/js/bootstrap5-toggle.ecmas.js @@ -230,7 +230,7 @@ } indeterminate(silent = false) { - if(!this.options.tristate) return false; + if (!this.options.tristate || this.element.disabled || this.element.readOnly) return false; this.ecmasToggle.classList.add('indeterminate'); this.element.indeterminate = true; this.element.removeAttribute('name'); @@ -240,12 +240,12 @@ } determinate(silent = false) { - if(!this.options.tristate) return false; + if (!this.options.tristate || this.element.disabled || this.element.readOnly) return false; this.ecmasToggle.classList.remove('indeterminate'); this.element.indeterminate = false; if(this.options.name) this.element.setAttribute('name', this.options.name); - if(this.invElement) target.invElement.indeterminate = false; - if(this.invElement && target.options.name) this.invElement.setAttribute('name', this.options.name); + if(this.invElement) this.invElement.indeterminate = false; + if(this.invElement && this.options.name) this.invElement.setAttribute('name', this.options.name); if (!silent) this.trigger() } diff --git a/js/bootstrap5-toggle.ecmas.min.js b/js/bootstrap5-toggle.ecmas.min.js index c4c9793..e213a50 100644 --- a/js/bootstrap5-toggle.ecmas.min.js +++ b/js/bootstrap5-toggle.ecmas.min.js @@ -8,5 +8,5 @@ * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE */ -"use strict";!function(){class s{constructor(e,t){const i="On",s="primary",n=null,l="Off",o="secondary",a=null,d="",h="",r=null,m=null,g=0,c=!1,b=null;t=t||{},this.element=e,this.options={on:this.element.getAttribute("data-on")||t.on||i,onstyle:this.element.getAttribute("data-onstyle")||t.onstyle||s,onvalue:this.element.getAttribute("value")||this.element.getAttribute("data-onvalue")||t.onvalue||n,off:this.element.getAttribute("data-off")||t.off||l,offstyle:this.element.getAttribute("data-offstyle")||t.offstyle||o,offvalue:this.element.getAttribute("data-offvalue")||t.offvalue||a,size:this.element.getAttribute("data-size")||t.size||d,style:this.element.getAttribute("data-style")||t.style||h,width:this.element.getAttribute("data-width")||t.width||r,height:this.element.getAttribute("data-height")||t.height||m,tabindex:this.element.getAttribute("tabindex")||t.tabindex||g,tristate:this.element.hasAttribute("tristate")||t.tristate||c,name:this.element.getAttribute("name")||t.name||b},this.render()}render(){function e(e){var t=window.getComputedStyle(e),e=e.offsetHeight,i=parseFloat(t.borderTopWidth);return e-parseFloat(t.borderBottomWidth)-i-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)}let t;switch(this.options.size){case"large":case"lg":t="btn-lg";break;case"small":case"sm":t="btn-sm";break;case"mini":case"xs":t="btn-xs";break;default:t=""}let i=document.createElement("label"),s=(i.setAttribute("class","btn btn-"+this.options.onstyle+" "+t),i.setAttribute("for",this.element.id),i.innerHTML=this.options.on,document.createElement("label")),n=(s.setAttribute("class","btn btn-"+this.options.offstyle+" "+t),s.setAttribute("for",this.element.id),s.innerHTML=this.options.off,document.createElement("span")),l=(n.setAttribute("class","toggle-handle btn "+t),document.createElement("div")),o=(l.setAttribute("class","toggle-group"),l.appendChild(i),l.appendChild(s),l.appendChild(n),document.createElement("div")),a=(o.setAttribute("class","toggle btn"),o.classList.add(this.element.checked?"btn-"+this.options.onstyle:"btn-"+this.options.offstyle),o.setAttribute("tabindex",this.options.tabindex),this.element.checked||o.classList.add("off"),this.options.size&&o.classList.add(t),this.options.style&&this.options.style.split(" ").forEach(e=>{o.classList.add(e)}),(this.element.disabled||this.element.readOnly)&&(o.classList.add("disabled"),o.setAttribute("disabled","disabled")),this.options.onvalue&&this.element.setAttribute("value",this.options.onvalue),null);this.options.offvalue&&((a=this.element.cloneNode()).setAttribute("value",this.options.offvalue),a.setAttribute("data-toggle","invert-toggle"),a.removeAttribute("id"),a.checked=!this.element.checked),this.element.parentElement.insertBefore(o,this.element),o.appendChild(this.element),a&&o.appendChild(a),o.appendChild(l),o.style.width=(this.options.width||Math.max(i.getBoundingClientRect().width,s.getBoundingClientRect().width)+n.getBoundingClientRect().width/2)+"px",o.style.height=(this.options.height||Math.max(i.getBoundingClientRect().height,s.getBoundingClientRect().height))+"px",i.classList.add("toggle-on"),s.classList.add("toggle-off"),this.options.height&&(i.style.lineHeight=e(i)+"px",s.style.lineHeight=e(s)+"px"),o.addEventListener("touchstart",e=>{this.#toggleActionPerformed(e)}),o.addEventListener("click",e=>{this.#toggleActionPerformed(e)}),o.addEventListener("keypress",e=>{" "==e.key&&this.#toggleActionPerformed(e)}),this.ecmasToggle=o,this.invElement=a,this.element.bsToggle=this}#toggleActionPerformed(e){this.options.tristate?this.ecmasToggle.classList.contains("indeterminate")?(this.determinate(!0),this.toggle()):this.indeterminate():this.toggle(),e.preventDefault()}toggle(e=!1){this.element.checked?this.off(e):this.on(e)}on(e=!1){if(this.element.disabled||this.element.readOnly)return!1;this.ecmasToggle.classList.remove("btn-"+this.options.offstyle),this.ecmasToggle.classList.add("btn-"+this.options.onstyle),this.ecmasToggle.classList.remove("off"),this.element.checked=!0,this.invElement&&(this.invElement.checked=!1),e||this.trigger()}off(e=!1){if(this.element.disabled||this.element.readOnly)return!1;this.ecmasToggle.classList.remove("btn-"+this.options.onstyle),this.ecmasToggle.classList.add("btn-"+this.options.offstyle),this.ecmasToggle.classList.add("off"),this.element.checked=!1,this.invElement&&(this.invElement.checked=!0),e||this.trigger()}indeterminate(e=!1){if(!this.options.tristate)return!1;this.ecmasToggle.classList.add("indeterminate"),this.element.indeterminate=!0,this.element.removeAttribute("name"),this.invElement&&(this.invElement.indeterminate=!0),this.invElement&&this.invElement.removeAttribute("name"),e||this.trigger()}determinate(e=!1){if(!this.options.tristate)return!1;this.ecmasToggle.classList.remove("indeterminate"),this.element.indeterminate=!1,this.options.name&&this.element.setAttribute("name",this.options.name),this.invElement&&(target.invElement.indeterminate=!1),this.invElement&&target.options.name&&this.invElement.setAttribute("name",this.options.name),e||this.trigger()}enable(){this.ecmasToggle.classList.remove("disabled"),this.ecmasToggle.removeAttribute("disabled"),this.element.removeAttribute("disabled"),this.element.removeAttribute("readonly"),this.invElement&&(this.invElement.removeAttribute("disabled"),this.invElement.removeAttribute("readonly"))}disable(){this.ecmasToggle.classList.add("disabled"),this.ecmasToggle.setAttribute("disabled",""),this.element.setAttribute("disabled",""),this.element.removeAttribute("readonly"),this.invElement&&(this.invElement.setAttribute("disabled",""),this.invElement.removeAttribute("readonly"))}readonly(){this.ecmasToggle.classList.add("disabled"),this.ecmasToggle.setAttribute("disabled",""),this.element.removeAttribute("disabled"),this.element.setAttribute("readonly",""),this.invElement&&(this.invElement.removeAttribute("disabled"),this.invElement.setAttribute("readonly",""))}update(e){this.element.disabled?this.disable():this.element.readOnly?this.readonly():this.enable(),this.element.checked?this.on(e):this.off(e)}trigger(e){e||this.element.dispatchEvent(new Event("change",{bubbles:!0}))}destroy(){this.ecmasToggle.parentNode.insertBefore(this.element,this.ecmasToggle),this.ecmasToggle.parentNode.removeChild(this.ecmasToggle),delete this.element.bsToggle,delete this.ecmasToggle}}Element.prototype.bootstrapToggle=function(e,t){let i=this.bsToggle||new s(this,e);e&&"string"==typeof e&&("toggle"==e.toLowerCase()?i.toggle(t):"on"==e.toLowerCase()?i.on(t):"off"==e.toLowerCase()?i.off(t):"indeterminate"==e.toLowerCase()?i.indeterminate(t):"determinate"==e.toLowerCase()?i.determinate(t):"enable"==e.toLowerCase()?i.enable():"disable"==e.toLowerCase()?i.disable():"readonly"==e.toLowerCase()?i.readonly():"destroy"==e.toLowerCase()&&i.destroy())},"undefined"!=typeof window&&(window.onload=function(){document.querySelectorAll('input[type=checkbox][data-toggle="toggle"]').forEach(function(e){e.bootstrapToggle()})}),"undefined"!=typeof module&&module.exports&&(module.exports=s)}(); +"use strict";!function(){class s{constructor(e,t){const i="On",s="primary",n=null,l="Off",o="secondary",a=null,d="",h="",r=null,m=null,g=0,c=!1,b=null;t=t||{},this.element=e,this.options={on:this.element.getAttribute("data-on")||t.on||i,onstyle:this.element.getAttribute("data-onstyle")||t.onstyle||s,onvalue:this.element.getAttribute("value")||this.element.getAttribute("data-onvalue")||t.onvalue||n,off:this.element.getAttribute("data-off")||t.off||l,offstyle:this.element.getAttribute("data-offstyle")||t.offstyle||o,offvalue:this.element.getAttribute("data-offvalue")||t.offvalue||a,size:this.element.getAttribute("data-size")||t.size||d,style:this.element.getAttribute("data-style")||t.style||h,width:this.element.getAttribute("data-width")||t.width||r,height:this.element.getAttribute("data-height")||t.height||m,tabindex:this.element.getAttribute("tabindex")||t.tabindex||g,tristate:this.element.hasAttribute("tristate")||t.tristate||c,name:this.element.getAttribute("name")||t.name||b},this.render()}render(){function e(e){var t=window.getComputedStyle(e),e=e.offsetHeight,i=parseFloat(t.borderTopWidth);return e-parseFloat(t.borderBottomWidth)-i-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)}let t;switch(this.options.size){case"large":case"lg":t="btn-lg";break;case"small":case"sm":t="btn-sm";break;case"mini":case"xs":t="btn-xs";break;default:t=""}let i=document.createElement("label"),s=(i.setAttribute("class","btn btn-"+this.options.onstyle+" "+t),i.setAttribute("for",this.element.id),i.innerHTML=this.options.on,document.createElement("label")),n=(s.setAttribute("class","btn btn-"+this.options.offstyle+" "+t),s.setAttribute("for",this.element.id),s.innerHTML=this.options.off,document.createElement("span")),l=(n.setAttribute("class","toggle-handle btn "+t),document.createElement("div")),o=(l.setAttribute("class","toggle-group"),l.appendChild(i),l.appendChild(s),l.appendChild(n),document.createElement("div")),a=(o.setAttribute("class","toggle btn"),o.classList.add(this.element.checked?"btn-"+this.options.onstyle:"btn-"+this.options.offstyle),o.setAttribute("tabindex",this.options.tabindex),this.element.checked||o.classList.add("off"),this.options.size&&o.classList.add(t),this.options.style&&this.options.style.split(" ").forEach(e=>{o.classList.add(e)}),(this.element.disabled||this.element.readOnly)&&(o.classList.add("disabled"),o.setAttribute("disabled","disabled")),this.options.onvalue&&this.element.setAttribute("value",this.options.onvalue),null);this.options.offvalue&&((a=this.element.cloneNode()).setAttribute("value",this.options.offvalue),a.setAttribute("data-toggle","invert-toggle"),a.removeAttribute("id"),a.checked=!this.element.checked),this.element.parentElement.insertBefore(o,this.element),o.appendChild(this.element),a&&o.appendChild(a),o.appendChild(l),o.style.width=(this.options.width||Math.max(i.getBoundingClientRect().width,s.getBoundingClientRect().width)+n.getBoundingClientRect().width/2)+"px",o.style.height=(this.options.height||Math.max(i.getBoundingClientRect().height,s.getBoundingClientRect().height))+"px",i.classList.add("toggle-on"),s.classList.add("toggle-off"),this.options.height&&(i.style.lineHeight=e(i)+"px",s.style.lineHeight=e(s)+"px"),o.addEventListener("touchstart",e=>{this.#toggleActionPerformed(e)}),o.addEventListener("click",e=>{this.#toggleActionPerformed(e)}),o.addEventListener("keypress",e=>{" "==e.key&&this.#toggleActionPerformed(e)}),this.ecmasToggle=o,this.invElement=a,this.element.bsToggle=this}#toggleActionPerformed(e){this.options.tristate?this.ecmasToggle.classList.contains("indeterminate")?(this.determinate(!0),this.toggle()):this.indeterminate():this.toggle(),e.preventDefault()}toggle(e=!1){this.element.checked?this.off(e):this.on(e)}on(e=!1){if(this.element.disabled||this.element.readOnly)return!1;this.ecmasToggle.classList.remove("btn-"+this.options.offstyle),this.ecmasToggle.classList.add("btn-"+this.options.onstyle),this.ecmasToggle.classList.remove("off"),this.element.checked=!0,this.invElement&&(this.invElement.checked=!1),e||this.trigger()}off(e=!1){if(this.element.disabled||this.element.readOnly)return!1;this.ecmasToggle.classList.remove("btn-"+this.options.onstyle),this.ecmasToggle.classList.add("btn-"+this.options.offstyle),this.ecmasToggle.classList.add("off"),this.element.checked=!1,this.invElement&&(this.invElement.checked=!0),e||this.trigger()}indeterminate(e=!1){if(!this.options.tristate||this.element.disabled||this.element.readOnly)return!1;this.ecmasToggle.classList.add("indeterminate"),this.element.indeterminate=!0,this.element.removeAttribute("name"),this.invElement&&(this.invElement.indeterminate=!0),this.invElement&&this.invElement.removeAttribute("name"),e||this.trigger()}determinate(e=!1){if(!this.options.tristate||this.element.disabled||this.element.readOnly)return!1;this.ecmasToggle.classList.remove("indeterminate"),this.element.indeterminate=!1,this.options.name&&this.element.setAttribute("name",this.options.name),this.invElement&&(this.invElement.indeterminate=!1),this.invElement&&this.options.name&&this.invElement.setAttribute("name",this.options.name),e||this.trigger()}enable(){this.ecmasToggle.classList.remove("disabled"),this.ecmasToggle.removeAttribute("disabled"),this.element.removeAttribute("disabled"),this.element.removeAttribute("readonly"),this.invElement&&(this.invElement.removeAttribute("disabled"),this.invElement.removeAttribute("readonly"))}disable(){this.ecmasToggle.classList.add("disabled"),this.ecmasToggle.setAttribute("disabled",""),this.element.setAttribute("disabled",""),this.element.removeAttribute("readonly"),this.invElement&&(this.invElement.setAttribute("disabled",""),this.invElement.removeAttribute("readonly"))}readonly(){this.ecmasToggle.classList.add("disabled"),this.ecmasToggle.setAttribute("disabled",""),this.element.removeAttribute("disabled"),this.element.setAttribute("readonly",""),this.invElement&&(this.invElement.removeAttribute("disabled"),this.invElement.setAttribute("readonly",""))}update(e){this.element.disabled?this.disable():this.element.readOnly?this.readonly():this.enable(),this.element.checked?this.on(e):this.off(e)}trigger(e){e||this.element.dispatchEvent(new Event("change",{bubbles:!0}))}destroy(){this.ecmasToggle.parentNode.insertBefore(this.element,this.ecmasToggle),this.ecmasToggle.parentNode.removeChild(this.ecmasToggle),delete this.element.bsToggle,delete this.ecmasToggle}}Element.prototype.bootstrapToggle=function(e,t){let i=this.bsToggle||new s(this,e);e&&"string"==typeof e&&("toggle"==e.toLowerCase()?i.toggle(t):"on"==e.toLowerCase()?i.on(t):"off"==e.toLowerCase()?i.off(t):"indeterminate"==e.toLowerCase()?i.indeterminate(t):"determinate"==e.toLowerCase()?i.determinate(t):"enable"==e.toLowerCase()?i.enable():"disable"==e.toLowerCase()?i.disable():"readonly"==e.toLowerCase()?i.readonly():"destroy"==e.toLowerCase()&&i.destroy())},"undefined"!=typeof window&&(window.onload=function(){document.querySelectorAll('input[type=checkbox][data-toggle="toggle"]').forEach(function(e){e.bootstrapToggle()})}),"undefined"!=typeof module&&module.exports&&(module.exports=s)}(); //# sourceMappingURL=bootstrap5-toggle.ecmas.min.js.map \ No newline at end of file diff --git a/js/bootstrap5-toggle.ecmas.min.js.map b/js/bootstrap5-toggle.ecmas.min.js.map index a2d7510..21966fb 100644 --- a/js/bootstrap5-toggle.ecmas.min.js.map +++ b/js/bootstrap5-toggle.ecmas.min.js.map @@ -1 +1 @@ -{"version":3,"file":"bootstrap5-toggle.ecmas.min.js","sources":["bootstrap5-toggle.ecmas.js"],"names":["Toggle","constructor","element","options","DEFAULTS","this","on","getAttribute","onstyle","onvalue","off","offstyle","offvalue","size","style","width","height","tabindex","tristate","hasAttribute","name","render","calcH","el","styles","window","getComputedStyle","offsetHeight","borderTopWidth","parseFloat","borderBottomWidth","paddingTop","paddingBottom","let","ecmasToggleOn","document","createElement","ecmasToggleOff","setAttribute","id","innerHTML","ecmasToggleHandle","ecmasToggleGroup","ecmasToggle","appendChild","invElement","classList","add","checked","split","forEach","disabled","readOnly","cloneNode","removeAttribute","parentElement","insertBefore","Math","max","getBoundingClientRect","lineHeight","addEventListener","#toggleActionPerformed","e","key","bsToggle","contains","determinate","toggle","indeterminate","preventDefault","silent","remove","trigger","target","enable","disable","readonly","update","dispatchEvent","Event","bubbles","destroy","parentNode","removeChild","Element","prototype","bootstrapToggle","_bsToggle","toLowerCase","onload","querySelectorAll","ele","module","exports"],"mappings":"cAaA,iBAIOA,EACLC,YAAYC,EAASC,GACpB,MAAMC,EACD,KADCA,EAEI,UAFJA,EAGI,KAHJA,EAIA,MAJAA,EAKK,YALLA,EAMK,KANLA,EAOC,GAPDA,EAQE,GARFA,EASE,KATFA,EAUG,KAVHA,EAWK,EAXLA,GAYK,EAZLA,EAaC,KAEPD,EAAUA,GAAW,GAGrBE,KAAKH,QAAUA,EAGfG,KAAKF,QAAU,CACdG,GAAID,KAAKH,QAAQK,aAAa,YAAcJ,EAAQG,IAAMF,EAC1DI,QAASH,KAAKH,QAAQK,aAAa,iBAAmBJ,EAAQK,SAAWJ,EACzEK,QAASJ,KAAKH,QAAQK,aAAa,UAAYF,KAAKH,QAAQK,aAAa,iBAAmBJ,EAAQM,SAAWL,EAC/GM,I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AAzBpE,EAAQsF,cAAuBD,EAAUlF,GAAGiE,GACnB,OAAzBpE,EAAQsF,cAAwBD,EAAU9E,IAAI6D,GACrB,iBAAzBpE,EAAQsF,cAAkCD,EAAUnB,cAAcE,GACzC,eAAzBpE,EAAQsF,cAAgCD,EAAUrB,YAAYI,GACrC,UAAzBpE,EAAQsF,cAA2BD,EAAUb,SACpB,WAAzBxE,EAAQsF,cAA4BD,EAAUZ,UACrB,YAAzBzE,EAAQsF,cAA6BD,EAAUX,WACtB,WAAzB1E,EAAQsF,eAA4BD,EAAUN,YAQnC,oBAAXzD,SACVA,OAAOiE,OAAS,WACfvD,SAASwD,iBAAiB,8CAA8CzC,QAAQ,SAAS0C,GACxFA,EAAIL,sBAKe,oBAAXM,QAA0BA,OAAOC,UAC3CD,OAAOC,QAAU9F,GAxUnB"} \ No newline at end of file +{"version":3,"file":"bootstrap5-toggle.ecmas.min.js","sources":["bootstrap5-toggle.ecmas.js"],"names":["Toggle","constructor","element","options","DEFAULTS","this","on","getAttribute","onstyle","onvalue","off","offstyle","offvalue","size","style","width","height","tabindex","tristate","hasAttribute","name","render","calcH","el","styles","window","getComputedStyle","offsetHeight","borderTopWidth","parseFloat","borderBottomWidth","paddingTop","paddingBottom","let","ecmasToggleOn","document","createElement","ecmasToggleOff","setAttribute","id","innerHTML","ecmasToggleHandle","ecmasToggleGroup","ecmasToggle","appendChild","invElement","classList","add","checked","split","forEach","disabled","readOnly","cloneNode","removeAttribute","parentElement","insertBefore","Math","max","getBoundingClientRect","lineHeight","addEventListener","#toggleActionPerformed","e","key","bsToggle","contains","determinate","toggle","indeterminate","preventDefault","silent","remove","trigger","enable","disable","readonly","update","dispatchEvent","Event","bubbles","destroy","parentNode","removeChild","Element","prototype","bootstrapToggle","_bsToggle","toLowerCase","onload","querySelectorAll","ele","module","exports"],"mappings":"cAaA,iBAIOA,EACLC,YAAYC,EAASC,GACpB,MAAMC,EACD,KADCA,EAEI,UAFJA,EAGI,KAHJA,EAIA,MAJA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C,KAAKC,GAAGiE,GAC7BlE,KAAKK,IAAI6D,GAGfE,QAAQF,GACFA,GAAQlE,KAAKH,QAAQ4E,cAAc,IAAIC,MAAM,SAAU,CAAEC,SAAS,KAGxEC,UAEC5E,KAAKsC,YAAYuC,WAAW1B,aAAanD,KAAKH,QAASG,KAAKsC,aAC5DtC,KAAKsC,YAAYuC,WAAWC,YAAY9E,KAAKsC,oBAGtCtC,KAAKH,QAAQ+D,gBACb5D,KAAKsC,aAQdyC,QAAQC,UAAUC,gBAAkB,SAASnF,EAASoE,GACrDtC,IAAIsD,EAAYlF,KAAK4D,UAAY,IAAIjE,EAAOK,KAAMF,GAG9CA,GAA8B,iBAAZA,IACQ,UAAzBA,EAAQqF,cAA2BD,EAAUnB,OAAOG,GACtB,MAAzBpE,EAAQqF,cAAuBD,EAAUjF,GAAGiE,GACnB,OAAzBpE,EAAQqF,cAAwBD,EAAU7E,IAAI6D,GACrB,iBAAzBpE,EAAQqF,cAAkCD,EAAUlB,cAAcE,GACzC,eAAzBpE,EAAQqF,cAAgCD,EAAUpB,YAAYI,GACrC,UAAzBpE,EAAQqF,cAA2BD,EAAUb,SACpB,WAAzBvE,EAAQqF,cAA4BD,EAAUZ,UACrB,YAAzBxE,EAAQqF,cAA6BD,EAAUX,WACtB,WAAzBzE,EAAQqF,eAA4BD,EAAUN,YAQnC,oBAAXxD,SACVA,OAAOgE,OAAS,WACftD,SAASuD,iBAAiB,8CAA8CxC,QAAQ,SAASyC,GACxFA,EAAIL,sBAKe,oBAAXM,QAA0BA,OAAOC,UAC3CD,OAAOC,QAAU7F,GAxUnB"} \ No newline at end of file diff --git a/js/bootstrap5-toggle.js b/js/bootstrap5-toggle.js index 8ceb336..eaea062 100644 --- a/js/bootstrap5-toggle.js +++ b/js/bootstrap5-toggle.js @@ -169,7 +169,7 @@ function toggleActionPerformed(e , target){ if(target.options.tristate){ if(target.$toggle.hasClass('indeterminate')){ - target.determinate(); + target.determinate(true); target.toggle(); }else{ target.indeterminate(); @@ -202,7 +202,7 @@ } Toggle.prototype.indeterminate = function (silent = false) { - if(!this.options.tristate) return false; + if (!this.options.tristate || this.$element.prop('disabled') || this.$element.prop('readonly')) return false; this.$toggle.addClass('indeterminate'); this.$element.prop('indeterminate', true); this.$element.removeAttr('name'); @@ -212,7 +212,7 @@ } Toggle.prototype.determinate = function (silent = false) { - if(!this.options.tristate) return false; + if (!this.options.tristate || this.$element.prop('disabled') || this.$element.prop('readonly')) return false; this.$toggle.removeClass('indeterminate'); this.$element.prop('indeterminate', false); if(this.options.name) this.$element.attr('name', this.options.name); @@ -274,6 +274,7 @@ // A: Remove button-group from UI, replace checkbox element this.$element.off('change.bs.toggle') this.$toggleGroup.remove() + if(this.$invElement) this.$invElement.remove() // B: Delete internal refs this.$element.removeData('bs.toggle') diff --git a/js/bootstrap5-toggle.min.js b/js/bootstrap5-toggle.min.js index 3cc2c7e..8857791 100644 --- a/js/bootstrap5-toggle.min.js +++ b/js/bootstrap5-toggle.min.js @@ -8,5 +8,5 @@ * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE */ -!function(h){"use strict";function o(t,e){this.$element=h(t),this.options=h.extend({},this.defaults(),e),this.render()}function r(t,e){e.options.tristate?e.$toggle.hasClass("indeterminate")?(e.determinate(),e.toggle()):e.indeterminate():e.toggle(),t.preventDefault()}o.DEFAULTS={on:"On",off:"Off",onstyle:"primary",offstyle:"secondary",onvalue:null,offvalue:null,size:"normal",style:"",width:null,height:null,tabindex:0,tristate:!1,name:null},o.prototype.defaults=function(){return{on:this.$element.attr("data-on")||o.DEFAULTS.on,off:this.$element.attr("data-off")||o.DEFAULTS.off,onstyle:this.$element.attr("data-onstyle")||o.DEFAULTS.onstyle,offstyle:this.$element.attr("data-offstyle")||o.DEFAULTS.offstyle,onvalue:this.$element.attr("value")||this.$element.attr("data-onvalue")||o.DEFAULTS.onvalue,offvalue:this.$element.attr("data-offvalue")||o.DEFAULTS.offvalue,size:this.$element.attr("data-size")||o.DEFAULTS.size,style:this.$element.attr("data-style")||o.DEFAULTS.style,width:this.$element.attr("data-width")||o.DEFAULTS.width,height:this.$element.attr("data-height")||o.DEFAULTS.height,tabindex:this.$element.attr("tabindex")||o.DEFAULTS.tabindex,tristate:this.$element.is("[tristate]")||o.DEFAULTS.tristate,name:this.$element.attr("name")||o.DEFAULTS.name}},o.prototype.render=function(){let t;switch(this.options.size){case"large":case"lg":t="btn-lg";break;case"small":case"sm":t="btn-sm";break;case"mini":case"xs":t="btn-xs";break;default:t=""}let e=h('