Socket
Socket
Sign inDemoInstall

@syncfusion/ej2-buttons

Package Overview
Dependencies
Maintainers
2
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@syncfusion/ej2-buttons - npm Package Compare versions

Comparing version 16.1.48 to 16.2.41

src/switch/index.d.ts

37

CHANGELOG.md

@@ -5,2 +5,8 @@ # Changelog

### Button
#### Breaking Changes
- Default color changed for the flat button
### RadioButton

@@ -12,12 +18,11 @@

## 16.1.35 (2018-04-17)
### Switch
### Button
Switch is a graphical user interface element that allows you to toggle between checked and unchecked states.
#### Bug Fixes
- **Text** - Supports text.
- **Sizes** - Provided with different sizes of Switch.
- Custom style issue fixed in material theme.
## 16.1.28 (2018-03-09)
## 16.1.28-preview (2018-03-09)
### CheckBox

@@ -29,3 +34,3 @@

## 16.1.24-preview (2018-02-22)
## 16.1.24 (2018-02-22)

@@ -38,20 +43,20 @@ ### Common

Enum Name |Old Property Value |New Property Value
Enum Name | Old Property Value | New Property Value
-----|-----|-----
IconPosition |left |Left
IconPosition |right |Right
`IconPosition` | left | Left
`IconPosition` | right | Right
Pascal casing changes in CheckBox Component.
Enum Name |Old Property Value |New Property Value
Enum Name | Old Property Value | New Property Value
-----|-----|-----
LabelPosition |after |After
LabelPosition |before |Before
`LabelPosition` | after | After
`LabelPosition` | before | Before
Pascal casing changes in RadioButton Component.
Enum Name |Old Property Value |New Property Value
Enum Name | Old Property Value | New Property Value
-----|-----|-----
RadioLabelPosition |after |After
RadioLabelPosition |before |Before
`RadioLabelPosition` | after | After
`RadioLabelPosition` | before | Before

@@ -58,0 +63,0 @@ ## 15.4.30-preview (2018-02-14)

@@ -1,11 +0,2 @@

/*!
* filename: ej2-buttons.umd.min.js
* version : 16.1.48
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],t):t(e.ej={},e.ej2Base)}(this,function(e,t){"use strict";function s(e,s,n,i){if(n.tagName===e){for(var a=t.getValue("ej2_instances",n),r=t.createElement("input",{attrs:{type:s}}),o=["change","cssClass","label","labelPosition"],l=t.createElement(e,{className:i,attrs:{role:s,"aria-checked":"false"}}),c=0,d=n.attributes.length;c<d;c++)-1===o.indexOf(n.attributes[c].nodeName)&&r.setAttribute(n.attributes[c].nodeName,n.attributes[c].nodeValue);n.parentNode.insertBefore(r,n),t.detach(n),(n=r).parentNode.insertBefore(l,n),l.appendChild(n),t.setValue("ej2_instances",a,n)}return n}function n(e){for(var t,s=e.childNodes,n=0;n<s.length;n++)if(3===(t=s[n]).nodeType)return t;return null}function i(e,t){if(t){var s=document.createEvent("MouseEvents");s.initEvent(e.type,!1,!0),t.dispatchEvent(s)}}var a=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])};return function(t,s){function n(){this.constructor=t}e(t,s),t.prototype=null===s?Object.create(s):(n.prototype=s.prototype,new n)}}(),r=function(e,t,s,n){var i,a=arguments.length,r=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,s):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,s,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(r=(a<3?i(r):a>3?i(t,s,r):i(t,s))||r);return a>3&&r&&Object.defineProperty(t,s,r),r},o="e-rtl",l="e-btn",c="e-primary",d="e-icon-btn",h=function(e){function s(t,s){return e.call(this,t,s)||this}return a(s,e),s.prototype.preRender=function(){},s.prototype.render=function(){this.initialize()},s.prototype.initialize=function(){this.cssClass&&t.addClass([this.element],this.cssClass.split(" ")),this.isPrimary&&this.element.classList.add(c),this.content&&(this.element.innerHTML=this.content),this.setIconCss(),this.enableRtl&&this.element.classList.add(o),this.disabled?this.controlStatus(this.disabled):this.wireEvents(),t.rippleEffect(this.element,{selector:"."+l})},s.prototype.controlStatus=function(e){this.element.disabled=e},s.prototype.setIconCss=function(){if(this.iconCss){var e=t.createElement("span",{className:"e-btn-icon "+this.iconCss});this.element.textContent.trim()?e.classList.add("e-icon-"+this.iconPosition.toLowerCase()):this.element.classList.add(d);var s=this.element.childNodes[0];s&&"Left"===this.iconPosition?this.element.insertBefore(e,s):this.element.appendChild(e)}},s.prototype.wireEvents=function(){this.isToggle&&t.EventHandler.add(this.element,"click",this.btnClickHandler,this)},s.prototype.unWireEvents=function(){this.isToggle&&t.EventHandler.remove(this.element,"click",this.btnClickHandler)},s.prototype.btnClickHandler=function(){this.element.classList.contains("e-active")?this.element.classList.remove("e-active"):this.element.classList.add("e-active")},s.prototype.destroy=function(){var s,n=this.element;e.prototype.destroy.call(this),t.removeClass([this.element],[c,o,d,"e-success","e-info","e-danger","e-warning","e-flat","e-outline","e-small","e-bigger","e-active","e-round"]),["e-ripple","disabled"].forEach(function(e){n.removeAttribute(e)}),this.content&&(n.innerHTML=n.innerHTML.replace(this.content,"")),(s=n.querySelector("span.e-btn-icon"))&&t.detach(s),this.unWireEvents()},s.prototype.getModuleName=function(){return"btn"},s.prototype.getPersistData=function(){return this.addOnPersist([])},s.prototype.onPropertyChanged=function(e,s){for(var i=0,a=Object.keys(e);i<a.length;i++){switch(a[i]){case"isPrimary":e.isPrimary?this.element.classList.add(c):this.element.classList.remove(c);break;case"disabled":this.controlStatus(e.disabled),this.unWireEvents();break;case"iconCss":var r=this.element.querySelector("span.e-btn-icon");r?(r.className="e-btn-icon "+e.iconCss,this.element.textContent.trim()&&("Left"===this.iconPosition?r.classList.add("e-icon-left"):r.classList.add("e-icon-right"))):this.setIconCss();break;case"iconPosition":(r=this.element.querySelector("span.e-btn-icon"))&&t.detach(r),this.setIconCss();break;case"cssClass":s.cssClass&&t.removeClass([this.element],s.cssClass.split(" ")),e.cssClass&&t.addClass([this.element],e.cssClass.split(" "));break;case"enableRtl":e.enableRtl?this.element.classList.add(o):this.element.classList.remove(o);break;case"content":n(this.element)||this.element.classList.remove(d),this.element.innerHTML=e.content,this.setIconCss();break;case"isToggle":e.isToggle?t.EventHandler.add(this.element,"click",this.btnClickHandler,this):(t.EventHandler.remove(this.element,"click",this.btnClickHandler),t.removeClass([this.element],["e-active"]))}}},r([t.Property("Left")],s.prototype,"iconPosition",void 0),r([t.Property("")],s.prototype,"iconCss",void 0),r([t.Property(!1)],s.prototype,"disabled",void 0),r([t.Property(!1)],s.prototype,"isPrimary",void 0),r([t.Property("")],s.prototype,"cssClass",void 0),r([t.Property("")],s.prototype,"content",void 0),r([t.Property(!1)],s.prototype,"isToggle",void 0),s=r([t.NotifyPropertyChanges],s)}(t.Component),p=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])};return function(t,s){function n(){this.constructor=t}e(t,s),t.prototype=null===s?Object.create(s):(n.prototype=s.prototype,new n)}}(),m=function(e,t,s,n){var i,a=arguments.length,r=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,s):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,s,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(r=(a<3?i(r):a>3?i(t,s,r):i(t,s))||r);return a>3&&r&&Object.defineProperty(t,s,r),r},u="e-checkbox-disabled",f="e-frame",v="e-ripple-container",y="e-ripple-check",b="e-ripple-stop",g="e-checkbox-wrapper",k=function(e){function n(t,s){var n=e.call(this,t,s)||this;return n.isKeyPressed=!1,n}return p(n,e),n.prototype.changeState=function(e){var s,n,i=this.getWrapper().getElementsByClassName(f)[0];t.isRippleEnabled&&(n=this.getWrapper().getElementsByClassName(v)[0]),"check"===e?(i.classList.remove("e-stop"),i.classList.add("e-check"),n&&(n.classList.remove(b),n.classList.add(y)),s="true",this.element.checked=!0):"uncheck"===e?(t.removeClass([i],["e-check","e-stop"]),n&&t.removeClass([n],[y,b]),s="false",this.element.checked=!1):(i.classList.remove("e-check"),i.classList.add("e-stop"),n&&(n.classList.remove(y),n.classList.add(b)),s="mixed",this.element.indeterminate=!0),this.getWrapper().setAttribute("aria-checked",s)},n.prototype.clickHandler=function(e){this.focusOutHandler(),this.indeterminate?(this.changeState(this.checked?"check":"uncheck"),this.indeterminate=!1,this.element.indeterminate=!1):this.checked?(this.changeState("uncheck"),this.checked=!1):(this.changeState("check"),this.checked=!0);var t={checked:this.element.checked,event:e};this.trigger("change",t)},n.prototype.destroy=function(){var s=this,n=this.getWrapper();e.prototype.destroy.call(this),this.disabled||this.unWireEvents(),"INPUT"===this.tagName?(n.parentNode.insertBefore(this.element,n),t.detach(n),this.element.checked=!1,this.indeterminate&&(this.element.indeterminate=!1),["name","value","disabled"].forEach(function(e){s.element.removeAttribute(e)})):(["role","aria-checked","class"].forEach(function(e){n.removeAttribute(e)}),this.element.id&&n.setAttribute("id",this.element.id),n.innerHTML="")},n.prototype.focusHandler=function(){this.isKeyPressed&&this.getWrapper().classList.add("e-focus")},n.prototype.focusOutHandler=function(){this.getWrapper().classList.remove("e-focus")},n.prototype.getModuleName=function(){return"checkbox"},n.prototype.getPersistData=function(){return this.addOnPersist(["checked","indeterminate"])},n.prototype.getWrapper=function(){return this.element.parentElement.parentElement},n.prototype.initialize=function(){this.name&&this.element.setAttribute("name",this.name),this.value&&this.element.setAttribute("value",this.value),this.checked&&this.changeState("check"),this.indeterminate&&this.changeState(),this.disabled&&this.setDisabled()},n.prototype.initWrapper=function(){var e=this.element.parentElement;e.classList.contains(g)||(e=t.createElement("div",{className:g,attrs:{role:"checkbox","aria-checked":"false"}}),this.element.parentNode.insertBefore(e,this.element));var s=t.createElement("label",{attrs:{for:this.element.id}}),n=t.createElement("span",{className:"e-icons "+f});if(this.enableRtl&&e.classList.add("e-rtl"),this.cssClass&&t.addClass([e],this.cssClass.split(" ")),e.appendChild(s),s.appendChild(this.element),s.appendChild(n),t.isRippleEnabled){var i=t.createElement("span",{className:v});"Before"===this.labelPosition?s.appendChild(i):s.insertBefore(i,n),t.rippleEffect(i,{duration:400,isCenterRipple:!0})}this.label&&this.setText(this.label)},n.prototype.keyDownHandler=function(){this.isKeyPressed=!0},n.prototype.labelMouseHandler=function(e){i(e,this.getWrapper().getElementsByClassName(v)[0])},n.prototype.mouseDownHandler=function(){this.isKeyPressed=!1},n.prototype.onPropertyChanged=function(e,s){for(var n=this.getWrapper(),i=0,a=Object.keys(e);i<a.length;i++){switch(a[i]){case"checked":this.indeterminate=!1,this.element.indeterminate=!1,this.changeState(e.checked?"check":"uncheck");break;case"indeterminate":e.indeterminate?this.changeState():(this.element.indeterminate=!1,this.changeState(this.checked?"check":"uncheck"));break;case"disabled":e.disabled?(this.setDisabled(),this.unWireEvents()):(this.element.disabled=!1,n.classList.remove(u),n.setAttribute("aria-disabled","false"),this.wireEvents());break;case"cssClass":s.cssClass&&n.classList.remove(s.cssClass),n.classList.add(e.cssClass);break;case"enableRtl":e.enableRtl?n.classList.add("e-rtl"):n.classList.remove("e-rtl");break;case"label":this.setText(e.label);break;case"labelPosition":var r=n.getElementsByClassName("e-label")[0],o=n.getElementsByTagName("label")[0];t.detach(r),"After"===e.labelPosition?o.appendChild(r):o.insertBefore(r,n.getElementsByClassName(f)[0]);break;case"name":this.element.setAttribute("name",e.name);break;case"value":this.element.setAttribute("value",e.value)}}},n.prototype.preRender=function(){var e=this.element;this.tagName=this.element.tagName,e=s("EJS-CHECKBOX","checkbox",e,g),this.element=e,"checkbox"!==this.element.getAttribute("type")&&this.element.setAttribute("type","checkbox"),this.element.id||(this.element.id=t.getUniqueID("e-"+this.getModuleName()))},n.prototype.render=function(){this.initWrapper(),this.initialize(),this.disabled||this.wireEvents()},n.prototype.setDisabled=function(){var e=this.getWrapper();this.element.disabled=!0,e.classList.add(u),e.setAttribute("aria-disabled","true")},n.prototype.setText=function(e){var s=this.getWrapper().getElementsByClassName("e-label")[0];if(s)s.textContent=e;else{s=t.createElement("span",{className:"e-label",innerHTML:e});var n=this.getWrapper().getElementsByTagName("label")[0];"Before"===this.labelPosition?n.insertBefore(s,this.getWrapper().getElementsByClassName(f)[0]):n.appendChild(s)}},n.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(this.element,"click",this.clickHandler),t.EventHandler.remove(document,"keydown",this.keyDownHandler),t.EventHandler.remove(e,"mousedown",this.mouseDownHandler),t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler);var s=e.getElementsByTagName("label")[0];t.EventHandler.remove(s,"mousedown",this.labelMouseHandler),t.EventHandler.remove(s,"mouseup",this.labelMouseHandler)},n.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(this.element,"click",this.clickHandler,this),t.EventHandler.add(document,"keydown",this.keyDownHandler,this),t.EventHandler.add(e,"mousedown",this.mouseDownHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this);var s=e.getElementsByTagName("label")[0];t.EventHandler.add(s,"mousedown",this.labelMouseHandler,this),t.EventHandler.add(s,"mouseup",this.labelMouseHandler,this)},m([t.Event()],n.prototype,"change",void 0),m([t.Property(!1)],n.prototype,"checked",void 0),m([t.Property("")],n.prototype,"cssClass",void 0),m([t.Property(!1)],n.prototype,"disabled",void 0),m([t.Property(!1)],n.prototype,"indeterminate",void 0),m([t.Property("")],n.prototype,"label",void 0),m([t.Property("After")],n.prototype,"labelPosition",void 0),m([t.Property("")],n.prototype,"name",void 0),m([t.Property("")],n.prototype,"value",void 0),n=m([t.NotifyPropertyChanges],n)}(t.Component),E=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])};return function(t,s){function n(){this.constructor=t}e(t,s),t.prototype=null===s?Object.create(s):(n.prototype=s.prototype,new n)}}(),C=function(e,t,s,n){var i,a=arguments.length,r=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,s):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,s,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(r=(a<3?i(r):a>3?i(t,s,r):i(t,s))||r);return a>3&&r&&Object.defineProperty(t,s,r),r},H="e-label",P="e-ripple-container",L="e-radio-wrapper",N=function(e){function n(t,s){var n=e.call(this,t,s)||this;return n.isKeyPressed=!1,n}return E(n,e),a=n,n.prototype.changeHandler=function(e){this.checked=!0,this.dataBind();var t={value:this.value,event:e};this.trigger("change",t)},n.prototype.updateChange=function(e){for(var s,n=this.element.getAttribute("name"),i=document.querySelectorAll('input.e-radio[name="'+n+'"]'),r=0;r<i.length;r++)(s=i[r])!==this.element&&(t.getInstance(s,a).checked=!1)},n.prototype.destroy=function(){var s=this,n=this.element.parentElement;e.prototype.destroy.call(this),this.disabled||this.unWireEvents(),"INPUT"===this.tagName?(n.parentNode.insertBefore(this.element,n),t.detach(n),this.element.checked=!1,["name","value","disabled"].forEach(function(e){s.element.removeAttribute(e)})):(["role","aria-checked","class"].forEach(function(e){n.removeAttribute(e)}),this.element.id&&n.setAttribute("id",this.element.id),n.innerHTML="")},n.prototype.focusHandler=function(){this.isKeyPressed&&this.getLabel().classList.add("e-focus")},n.prototype.focusOutHandler=function(){this.getLabel().classList.remove("e-focus")},n.prototype.getModuleName=function(){return"radio"},n.prototype.getPersistData=function(){return this.addOnPersist(["checked"])},n.prototype.getLabel=function(){return this.element.nextElementSibling},n.prototype.initialize=function(){this.initWrapper(),this.name&&this.element.setAttribute("name",this.name),this.value&&this.element.setAttribute("value",this.value),this.checked&&(this.element.checked=!0),this.disabled&&this.setDisabled()},n.prototype.initWrapper=function(){var e,s=this.element.parentElement;s.classList.contains(L)||(s=t.createElement("div",{className:L}),this.element.parentNode.insertBefore(s,this.element));var n=t.createElement("label",{attrs:{for:this.element.id}});s.appendChild(this.element),s.appendChild(n),t.isRippleEnabled&&(e=t.createElement("span",{className:P}),n.appendChild(e),t.rippleEffect(e,{duration:400,isCenterRipple:!0})),this.enableRtl&&n.classList.add("e-rtl"),this.cssClass&&t.addClass([n],this.cssClass.split(" ")),this.label&&this.setText(this.label)},n.prototype.keyDownHandler=function(){this.isKeyPressed=!0},n.prototype.labelRippleHandler=function(e){i(e,this.getLabel().getElementsByClassName(P)[0])},n.prototype.mouseDownHandler=function(){this.isKeyPressed=!1},n.prototype.onPropertyChanged=function(e,s){for(var n=this.getLabel(),i=0,a=Object.keys(e);i<a.length;i++){switch(a[i]){case"checked":e.checked&&this.updateChange(e.checked),this.element.checked=e.checked;break;case"disabled":e.disabled?(this.setDisabled(),this.unWireEvents()):(this.element.disabled=!1,this.wireEvents());break;case"cssClass":s.cssClass&&t.removeClass([n],s.cssClass.split(" ")),t.addClass([n],e.cssClass.split(" "));break;case"enableRtl":e.enableRtl?n.classList.add("e-rtl"):n.classList.remove("e-rtl");break;case"label":this.setText(e.label);break;case"labelPosition":"Before"===e.labelPosition?n.classList.add("e-right"):n.classList.remove("e-right");break;case"name":this.element.setAttribute("name",e.name);break;case"value":this.element.setAttribute("value",e.value)}}},n.prototype.preRender=function(){var e=this.element;this.tagName=this.element.tagName,e=s("EJS-RADIOBUTTON","radio",e,L),this.element=e,"radio"!==this.element.getAttribute("type")&&this.element.setAttribute("type","radio"),this.element.id||(this.element.id=t.getUniqueID("e-"+this.getModuleName()))},n.prototype.render=function(){this.initialize(),this.disabled||this.wireEvents()},n.prototype.setDisabled=function(){this.element.disabled=!0},n.prototype.setText=function(e){var s=this.getLabel(),n=s.getElementsByClassName(H)[0];n?n.textContent=e:(n=t.createElement("span",{className:H,innerHTML:e}),s.appendChild(n)),"Before"===this.labelPosition?this.getLabel().classList.add("e-right"):this.getLabel().classList.remove("e-right")},n.prototype.unWireEvents=function(){var e=this.getLabel();t.EventHandler.remove(this.element,"change",this.changeHandler),t.EventHandler.remove(document,"keydown",this.keyDownHandler),t.EventHandler.remove(e,"mousedown",this.mouseDownHandler),t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler);var s=e.getElementsByClassName(H)[0];s&&(t.EventHandler.remove(s,"mousedown",this.labelRippleHandler),t.EventHandler.remove(s,"mouseup",this.labelRippleHandler))},n.prototype.wireEvents=function(){var e=this.getLabel();t.EventHandler.add(this.element,"change",this.changeHandler,this),t.EventHandler.add(document,"keydown",this.keyDownHandler,this),t.EventHandler.add(e,"mousedown",this.mouseDownHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this);var s=e.getElementsByClassName(H)[0];s&&(t.EventHandler.add(s,"mousedown",this.labelRippleHandler,this),t.EventHandler.add(s,"mouseup",this.labelRippleHandler,this))},C([t.Event()],n.prototype,"change",void 0),C([t.Property(!1)],n.prototype,"checked",void 0),C([t.Property("")],n.prototype,"cssClass",void 0),C([t.Property(!1)],n.prototype,"disabled",void 0),C([t.Property("")],n.prototype,"label",void 0),C([t.Property("After")],n.prototype,"labelPosition",void 0),C([t.Property("")],n.prototype,"name",void 0),C([t.Property("")],n.prototype,"value",void 0),n=a=C([t.NotifyPropertyChanges],n);var a}(t.Component);e.wrapperInitialize=s,e.getTextNode=n,e.createCheckBox=function(e,s){void 0===e&&(e=!1),void 0===s&&(s={});var n=t.createElement("div",{className:"e-checkbox-wrapper e-css"});if(s.cssClass&&t.addClass([n],s.cssClass.split(" ")),s.enableRtl&&n.classList.add("e-rtl"),e){var i=t.createElement("span",{className:"e-ripple-container"});t.rippleEffect(i,{isCenterRipple:!0,duration:400}),n.appendChild(i)}var a=t.createElement("span",{className:"e-frame e-icons"});if(s.checked&&a.classList.add("e-check"),n.appendChild(a),s.label){var r=t.createElement("span",{className:"e-label",innerHTML:s.label});n.appendChild(r)}return n},e.rippleMouseHandler=i,e.Button=h,e.CheckBox=k,e.RadioButton=N,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],t):t(e.ej={},e.ej2Base)}(this,function(e,t){"use strict";function s(e,s,i,n,a){if(i.tagName===e){for(var r=t.getValue("ej2_instances",i),o=t.createElement("input",{attrs:{type:s}}),l=["change","cssClass","label","labelPosition"],c=t.createElement(e,{className:n,attrs:{role:a,"aria-checked":"false"}}),d=0,h=i.attributes.length;d<h;d++)-1===l.indexOf(i.attributes[d].nodeName)&&o.setAttribute(i.attributes[d].nodeName,i.attributes[d].nodeValue);i.parentNode.insertBefore(o,i),t.detach(i),(i=o).parentNode.insertBefore(c,i),c.appendChild(i),t.setValue("ej2_instances",r,i)}return i}function i(e){for(var t,s=e.childNodes,i=0;i<s.length;i++)if(3===(t=s[i]).nodeType)return t;return null}function n(e,s,i){"INPUT"===i?(s.parentNode.insertBefore(e.element,s),t.detach(s),e.element.checked=!1,["name","value","disabled"].forEach(function(t){e.element.removeAttribute(t)})):(e.element.id&&s.setAttribute("id",e.element.id),["role","aria-checked","class"].forEach(function(e){s.removeAttribute(e)}),s.innerHTML="")}function a(e,i,n,a,r){a=s(i,"checkbox",a,n,r),e.element=a,"checkbox"!==e.element.getAttribute("type")&&e.element.setAttribute("type","checkbox"),e.element.id||(e.element.id=t.getUniqueID("e-"+r))}function r(e,t){if(t){var s=document.createEvent("MouseEvents");s.initEvent(e.type,!1,!0),t.dispatchEvent(s)}}var o=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])};return function(t,s){function i(){this.constructor=t}e(t,s),t.prototype=null===s?Object.create(s):(i.prototype=s.prototype,new i)}}(),l=function(e,t,s,i){var n,a=arguments.length,r=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(r=(a<3?n(r):a>3?n(t,s,r):n(t,s))||r);return a>3&&r&&Object.defineProperty(t,s,r),r},c="e-rtl",d="e-btn",h="e-primary",p="e-icon-btn",u=function(e){function s(t,s){return e.call(this,t,s)||this}return o(s,e),s.prototype.preRender=function(){},s.prototype.render=function(){this.initialize()},s.prototype.initialize=function(){this.cssClass&&t.addClass([this.element],this.cssClass.split(" ")),this.isPrimary&&this.element.classList.add(h),this.content&&(this.element.innerHTML=this.content),this.setIconCss(),this.enableRtl&&this.element.classList.add(c),this.disabled?this.controlStatus(this.disabled):this.wireEvents(),this.removeRippleEffect=t.rippleEffect(this.element,{selector:"."+d})},s.prototype.controlStatus=function(e){this.element.disabled=e},s.prototype.setIconCss=function(){if(this.iconCss){var e=t.createElement("span",{className:"e-btn-icon "+this.iconCss});this.element.textContent.trim()?e.classList.add("e-icon-"+this.iconPosition.toLowerCase()):this.element.classList.add(p);var s=this.element.childNodes[0];s&&"Left"===this.iconPosition?this.element.insertBefore(e,s):this.element.appendChild(e)}},s.prototype.wireEvents=function(){this.isToggle&&t.EventHandler.add(this.element,"click",this.btnClickHandler,this)},s.prototype.unWireEvents=function(){this.isToggle&&t.EventHandler.remove(this.element,"click",this.btnClickHandler)},s.prototype.btnClickHandler=function(){this.element.classList.contains("e-active")?this.element.classList.remove("e-active"):this.element.classList.add("e-active")},s.prototype.destroy=function(){var s,i=this.element;e.prototype.destroy.call(this),t.removeClass([this.element],[h,c,p,"e-success","e-info","e-danger","e-warning","e-flat","e-outline","e-small","e-bigger","e-active","e-round"]),["e-ripple","disabled"].forEach(function(e){i.removeAttribute(e)}),this.content&&(i.innerHTML=i.innerHTML.replace(this.content,"")),(s=i.querySelector("span.e-btn-icon"))&&t.detach(s),this.unWireEvents(),this.removeRippleEffect()},s.prototype.getModuleName=function(){return"btn"},s.prototype.getPersistData=function(){return this.addOnPersist([])},s.prototype.onPropertyChanged=function(e,s){for(var n=0,a=Object.keys(e);n<a.length;n++){switch(a[n]){case"isPrimary":e.isPrimary?this.element.classList.add(h):this.element.classList.remove(h);break;case"disabled":this.controlStatus(e.disabled),this.unWireEvents();break;case"iconCss":var r=this.element.querySelector("span.e-btn-icon");r?(r.className="e-btn-icon "+e.iconCss,this.element.textContent.trim()&&("Left"===this.iconPosition?r.classList.add("e-icon-left"):r.classList.add("e-icon-right"))):this.setIconCss();break;case"iconPosition":(r=this.element.querySelector("span.e-btn-icon"))&&t.detach(r),this.setIconCss();break;case"cssClass":s.cssClass&&t.removeClass([this.element],s.cssClass.split(" ")),e.cssClass&&t.addClass([this.element],e.cssClass.split(" "));break;case"enableRtl":e.enableRtl?this.element.classList.add(c):this.element.classList.remove(c);break;case"content":i(this.element)||this.element.classList.remove(p),this.element.innerHTML=e.content,this.setIconCss();break;case"isToggle":e.isToggle?t.EventHandler.add(this.element,"click",this.btnClickHandler,this):(t.EventHandler.remove(this.element,"click",this.btnClickHandler),t.removeClass([this.element],["e-active"]))}}},l([t.Property("Left")],s.prototype,"iconPosition",void 0),l([t.Property("")],s.prototype,"iconCss",void 0),l([t.Property(!1)],s.prototype,"disabled",void 0),l([t.Property(!1)],s.prototype,"isPrimary",void 0),l([t.Property("")],s.prototype,"cssClass",void 0),l([t.Property("")],s.prototype,"content",void 0),l([t.Property(!1)],s.prototype,"isToggle",void 0),s=l([t.NotifyPropertyChanges],s)}(t.Component),m=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])};return function(t,s){function i(){this.constructor=t}e(t,s),t.prototype=null===s?Object.create(s):(i.prototype=s.prototype,new i)}}(),f=function(e,t,s,i){var n,a=arguments.length,r=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(r=(a<3?n(r):a>3?n(t,s,r):n(t,s))||r);return a>3&&r&&Object.defineProperty(t,s,r),r},v="e-checkbox-disabled",y="e-frame",b="e-ripple-container",g="e-ripple-check",E="e-ripple-stop",k="e-checkbox-wrapper",C=function(e){function i(t,s){var i=e.call(this,t,s)||this;return i.isKeyPressed=!1,i}return m(i,e),i.prototype.changeState=function(e){var s,i,n=this.getWrapper().getElementsByClassName(y)[0];t.isRippleEnabled&&(i=this.getWrapper().getElementsByClassName(b)[0]),"check"===e?(n.classList.remove("e-stop"),n.classList.add("e-check"),i&&(i.classList.remove(E),i.classList.add(g)),s="true",this.element.checked=!0):"uncheck"===e?(t.removeClass([n],["e-check","e-stop"]),i&&t.removeClass([i],[g,E]),s="false",this.element.checked=!1):(n.classList.remove("e-check"),n.classList.add("e-stop"),i&&(i.classList.remove(g),i.classList.add(E)),s="mixed",this.element.indeterminate=!0),this.getWrapper().setAttribute("aria-checked",s)},i.prototype.clickHandler=function(e){this.focusOutHandler(),this.indeterminate?(this.changeState(this.checked?"check":"uncheck"),this.indeterminate=!1,this.element.indeterminate=!1):this.checked?(this.changeState("uncheck"),this.checked=!1):(this.changeState("check"),this.checked=!0);var t={checked:this.element.checked,event:e};this.trigger("change",t)},i.prototype.destroy=function(){var s=this,i=this.getWrapper();e.prototype.destroy.call(this),this.disabled||this.unWireEvents(),"INPUT"===this.tagName?(i.parentNode.insertBefore(this.element,i),t.detach(i),this.element.checked=!1,this.indeterminate&&(this.element.indeterminate=!1),["name","value","disabled"].forEach(function(e){s.element.removeAttribute(e)})):(["role","aria-checked","class"].forEach(function(e){i.removeAttribute(e)}),this.element.id&&i.setAttribute("id",this.element.id),i.innerHTML="")},i.prototype.focusHandler=function(){this.isKeyPressed&&this.getWrapper().classList.add("e-focus")},i.prototype.focusOutHandler=function(){this.getWrapper().classList.remove("e-focus")},i.prototype.getModuleName=function(){return"checkbox"},i.prototype.getPersistData=function(){return this.addOnPersist(["checked","indeterminate"])},i.prototype.getWrapper=function(){return this.element.parentElement.parentElement},i.prototype.initialize=function(){this.name&&this.element.setAttribute("name",this.name),this.value&&this.element.setAttribute("value",this.value),this.checked&&this.changeState("check"),this.indeterminate&&this.changeState(),this.disabled&&this.setDisabled()},i.prototype.initWrapper=function(){var e=this.element.parentElement;e.classList.contains(k)||(e=t.createElement("div",{className:k,attrs:{role:"checkbox","aria-checked":"false"}}),this.element.parentNode.insertBefore(e,this.element));var s=t.createElement("label",{attrs:{for:this.element.id}}),i=t.createElement("span",{className:"e-icons "+y});if(this.enableRtl&&e.classList.add("e-rtl"),this.cssClass&&t.addClass([e],this.cssClass.split(" ")),e.appendChild(s),s.appendChild(this.element),s.appendChild(i),t.isRippleEnabled){var n=t.createElement("span",{className:b});"Before"===this.labelPosition?s.appendChild(n):s.insertBefore(n,i),t.rippleEffect(n,{duration:400,isCenterRipple:!0})}this.label&&this.setText(this.label)},i.prototype.keyDownHandler=function(){this.isKeyPressed=!0},i.prototype.labelMouseHandler=function(e){r(e,this.getWrapper().getElementsByClassName(b)[0])},i.prototype.mouseDownHandler=function(){this.isKeyPressed=!1},i.prototype.onPropertyChanged=function(e,s){for(var i=this.getWrapper(),n=0,a=Object.keys(e);n<a.length;n++){switch(a[n]){case"checked":this.indeterminate=!1,this.element.indeterminate=!1,this.changeState(e.checked?"check":"uncheck");break;case"indeterminate":e.indeterminate?this.changeState():(this.element.indeterminate=!1,this.changeState(this.checked?"check":"uncheck"));break;case"disabled":e.disabled?(this.setDisabled(),this.unWireEvents()):(this.element.disabled=!1,i.classList.remove(v),i.setAttribute("aria-disabled","false"),this.wireEvents());break;case"cssClass":s.cssClass&&i.classList.remove(s.cssClass),i.classList.add(e.cssClass);break;case"enableRtl":e.enableRtl?i.classList.add("e-rtl"):i.classList.remove("e-rtl");break;case"label":this.setText(e.label);break;case"labelPosition":var r=i.getElementsByClassName("e-label")[0],o=i.getElementsByTagName("label")[0];t.detach(r),"After"===e.labelPosition?o.appendChild(r):o.insertBefore(r,i.getElementsByClassName(y)[0]);break;case"name":this.element.setAttribute("name",e.name);break;case"value":this.element.setAttribute("value",e.value)}}},i.prototype.preRender=function(){var e=this.element;this.tagName=this.element.tagName,e=s("EJS-CHECKBOX","checkbox",e,k,"checkbox"),this.element=e,"checkbox"!==this.element.getAttribute("type")&&this.element.setAttribute("type","checkbox"),this.element.id||(this.element.id=t.getUniqueID("e-"+this.getModuleName()))},i.prototype.render=function(){this.initWrapper(),this.initialize(),this.disabled||this.wireEvents()},i.prototype.setDisabled=function(){var e=this.getWrapper();this.element.disabled=!0,e.classList.add(v),e.setAttribute("aria-disabled","true")},i.prototype.setText=function(e){var s=this.getWrapper().getElementsByClassName("e-label")[0];if(s)s.textContent=e;else{s=t.createElement("span",{className:"e-label",innerHTML:e});var i=this.getWrapper().getElementsByTagName("label")[0];"Before"===this.labelPosition?i.insertBefore(s,this.getWrapper().getElementsByClassName(y)[0]):i.appendChild(s)}},i.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(this.element,"click",this.clickHandler),t.EventHandler.remove(document,"keydown",this.keyDownHandler),t.EventHandler.remove(e,"mousedown",this.mouseDownHandler),t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler);var s=e.getElementsByTagName("label")[0];t.EventHandler.remove(s,"mousedown",this.labelMouseHandler),t.EventHandler.remove(s,"mouseup",this.labelMouseHandler)},i.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(this.element,"click",this.clickHandler,this),t.EventHandler.add(document,"keydown",this.keyDownHandler,this),t.EventHandler.add(e,"mousedown",this.mouseDownHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this);var s=e.getElementsByTagName("label")[0];t.EventHandler.add(s,"mousedown",this.labelMouseHandler,this),t.EventHandler.add(s,"mouseup",this.labelMouseHandler,this)},f([t.Event()],i.prototype,"change",void 0),f([t.Property(!1)],i.prototype,"checked",void 0),f([t.Property("")],i.prototype,"cssClass",void 0),f([t.Property(!1)],i.prototype,"disabled",void 0),f([t.Property(!1)],i.prototype,"indeterminate",void 0),f([t.Property("")],i.prototype,"label",void 0),f([t.Property("After")],i.prototype,"labelPosition",void 0),f([t.Property("")],i.prototype,"name",void 0),f([t.Property("")],i.prototype,"value",void 0),i=f([t.NotifyPropertyChanges],i)}(t.Component),H=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])};return function(t,s){function i(){this.constructor=t}e(t,s),t.prototype=null===s?Object.create(s):(i.prototype=s.prototype,new i)}}(),P=function(e,t,s,i){var n,a=arguments.length,r=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(r=(a<3?n(r):a>3?n(t,s,r):n(t,s))||r);return a>3&&r&&Object.defineProperty(t,s,r),r},w="e-label",L="e-ripple-container",N="e-radio-wrapper",O=function(e){function i(t,s){var i=e.call(this,t,s)||this;return i.isKeyPressed=!1,i}return H(i,e),n=i,i.prototype.changeHandler=function(e){this.checked=!0,this.dataBind();var t={value:this.value,event:e};this.trigger("change",t)},i.prototype.updateChange=function(e){for(var s,i=this.element.getAttribute("name"),a=document.querySelectorAll('input.e-radio[name="'+i+'"]'),r=0;r<a.length;r++)(s=a[r])!==this.element&&(t.getInstance(s,n).checked=!1)},i.prototype.destroy=function(){var s=this,i=this.element.parentElement;e.prototype.destroy.call(this),this.disabled||this.unWireEvents(),"INPUT"===this.tagName?(i.parentNode.insertBefore(this.element,i),t.detach(i),this.element.checked=!1,["name","value","disabled"].forEach(function(e){s.element.removeAttribute(e)})):(["role","aria-checked","class"].forEach(function(e){i.removeAttribute(e)}),this.element.id&&i.setAttribute("id",this.element.id),i.innerHTML="")},i.prototype.focusHandler=function(){this.isKeyPressed&&this.getLabel().classList.add("e-focus")},i.prototype.focusOutHandler=function(){this.getLabel().classList.remove("e-focus")},i.prototype.getModuleName=function(){return"radio"},i.prototype.getPersistData=function(){return this.addOnPersist(["checked"])},i.prototype.getLabel=function(){return this.element.nextElementSibling},i.prototype.initialize=function(){this.initWrapper(),this.name&&this.element.setAttribute("name",this.name),this.value&&this.element.setAttribute("value",this.value),this.checked&&(this.element.checked=!0),this.disabled&&this.setDisabled()},i.prototype.initWrapper=function(){var e,s=this.element.parentElement;s.classList.contains(N)||(s=t.createElement("div",{className:N}),this.element.parentNode.insertBefore(s,this.element));var i=t.createElement("label",{attrs:{for:this.element.id}});s.appendChild(this.element),s.appendChild(i),t.isRippleEnabled&&(e=t.createElement("span",{className:L}),i.appendChild(e),t.rippleEffect(e,{duration:400,isCenterRipple:!0})),this.enableRtl&&i.classList.add("e-rtl"),this.cssClass&&t.addClass([i],this.cssClass.split(" ")),this.label&&this.setText(this.label)},i.prototype.keyDownHandler=function(){this.isKeyPressed=!0},i.prototype.labelRippleHandler=function(e){r(e,this.getLabel().getElementsByClassName(L)[0])},i.prototype.mouseDownHandler=function(){this.isKeyPressed=!1},i.prototype.onPropertyChanged=function(e,s){for(var i=this.getLabel(),n=0,a=Object.keys(e);n<a.length;n++){switch(a[n]){case"checked":e.checked&&this.updateChange(e.checked),this.element.checked=e.checked;break;case"disabled":e.disabled?(this.setDisabled(),this.unWireEvents()):(this.element.disabled=!1,this.wireEvents());break;case"cssClass":s.cssClass&&t.removeClass([i],s.cssClass.split(" ")),t.addClass([i],e.cssClass.split(" "));break;case"enableRtl":e.enableRtl?i.classList.add("e-rtl"):i.classList.remove("e-rtl");break;case"label":this.setText(e.label);break;case"labelPosition":"Before"===e.labelPosition?i.classList.add("e-right"):i.classList.remove("e-right");break;case"name":this.element.setAttribute("name",e.name);break;case"value":this.element.setAttribute("value",e.value)}}},i.prototype.preRender=function(){var e=this.element;this.tagName=this.element.tagName,e=s("EJS-RADIOBUTTON","radio",e,N,"radio"),this.element=e,"radio"!==this.element.getAttribute("type")&&this.element.setAttribute("type","radio"),this.element.id||(this.element.id=t.getUniqueID("e-"+this.getModuleName()))},i.prototype.render=function(){this.initialize(),this.disabled||this.wireEvents()},i.prototype.setDisabled=function(){this.element.disabled=!0},i.prototype.setText=function(e){var s=this.getLabel(),i=s.getElementsByClassName(w)[0];i?i.textContent=e:(i=t.createElement("span",{className:w,innerHTML:e}),s.appendChild(i)),"Before"===this.labelPosition?this.getLabel().classList.add("e-right"):this.getLabel().classList.remove("e-right")},i.prototype.unWireEvents=function(){var e=this.getLabel();t.EventHandler.remove(this.element,"change",this.changeHandler),t.EventHandler.remove(document,"keydown",this.keyDownHandler),t.EventHandler.remove(e,"mousedown",this.mouseDownHandler),t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler);var s=e.getElementsByClassName(w)[0];s&&(t.EventHandler.remove(s,"mousedown",this.labelRippleHandler),t.EventHandler.remove(s,"mouseup",this.labelRippleHandler))},i.prototype.wireEvents=function(){var e=this.getLabel();t.EventHandler.add(this.element,"change",this.changeHandler,this),t.EventHandler.add(document,"keydown",this.keyDownHandler,this),t.EventHandler.add(e,"mousedown",this.mouseDownHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this);var s=e.getElementsByClassName(w)[0];s&&(t.EventHandler.add(s,"mousedown",this.labelRippleHandler,this),t.EventHandler.add(s,"mouseup",this.labelRippleHandler,this))},P([t.Event()],i.prototype,"change",void 0),P([t.Property(!1)],i.prototype,"checked",void 0),P([t.Property("")],i.prototype,"cssClass",void 0),P([t.Property(!1)],i.prototype,"disabled",void 0),P([t.Property("")],i.prototype,"label",void 0),P([t.Property("After")],i.prototype,"labelPosition",void 0),P([t.Property("")],i.prototype,"name",void 0),P([t.Property("")],i.prototype,"value",void 0),i=n=P([t.NotifyPropertyChanges],i);var n}(t.Component),R=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])};return function(t,s){function i(){this.constructor=t}e(t,s),t.prototype=null===s?Object.create(s):(i.prototype=s.prototype,new i)}}(),W=function(e,t,s,i){var n,a=arguments.length,r=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(r=(a<3?n(r):a>3?n(t,s,r):n(t,s))||r);return a>3&&r&&Object.defineProperty(t,s,r),r},A="e-switch-disabled",B="e-ripple-container",D="e-ripple-check",T="e-switch-wrapper",_="e-switch-active",x=function(e){function s(t,s){var i=e.call(this,t,s)||this;return i.isKeyPressed=!1,i.isDrag=!1,i}return R(s,e),s.prototype.changeState=function(e){var s,i,n=this.getWrapper(),a=n.querySelector(".e-switch-inner"),r=n.querySelector(".e-switch-handle");t.isRippleEnabled&&(i=n.getElementsByClassName(B)[0]),e?(t.addClass([a,r],_),s="true",this.element.checked=!0,this.checked=!0,i&&t.addClass([i],[D])):(t.removeClass([a,r],_),s="false",this.element.checked=!1,this.checked=!1,i&&t.removeClass([i],[D])),n.setAttribute("aria-checked",s)},s.prototype.clickHandler=function(e){this.isDrag=!1,this.focusOutHandler(),this.changeState(!this.checked),this.element.focus();var t={checked:this.element.checked,event:e};this.trigger("change",t)},s.prototype.destroy=function(){e.prototype.destroy.call(this),this.disabled||this.unWireEvents(),n(this,this.getWrapper(),this.tagName)},s.prototype.focusHandler=function(){this.isKeyPressed&&this.getWrapper().classList.add("e-focus")},s.prototype.focusOutHandler=function(){this.getWrapper().classList.remove("e-focus")},s.prototype.getModuleName=function(){return"switch"},s.prototype.getPersistData=function(){return this.addOnPersist(["checked"])},s.prototype.getWrapper=function(){return this.element.parentElement},s.prototype.initialize=function(){this.name&&this.element.setAttribute("name",this.name),this.value&&this.element.setAttribute("value",this.value),this.checked&&this.changeState(!0),this.disabled&&this.setDisabled(),(this.onLabel||this.offLabel)&&this.setLabel(this.onLabel,this.offLabel)},s.prototype.initWrapper=function(){var e=this.element.parentElement;e.classList.contains(T)||(e=t.createElement("div",{className:T,attrs:{role:"switch","aria-checked":"false"}}),this.element.parentNode.insertBefore(e,this.element));var s=t.createElement("span",{className:"e-switch-inner"}),i=t.createElement("span",{className:"e-switch-on"}),n=t.createElement("span",{className:"e-switch-off"}),a=t.createElement("span",{className:"e-switch-handle"});if(e.appendChild(this.element),s.appendChild(i),s.appendChild(n),e.appendChild(s),e.appendChild(a),t.isRippleEnabled){var r=t.createElement("span",{className:B});a.appendChild(r),t.rippleEffect(r,{duration:400,isCenterRipple:!0})}this.enableRtl&&e.classList.add("e-rtl"),this.cssClass&&t.addClass([e],this.cssClass.split(" "))},s.prototype.onPropertyChanged=function(e,t){for(var s=this.getWrapper(),i=0,n=Object.keys(e);i<n.length;i++){switch(n[i]){case"checked":this.changeState(e.checked);break;case"disabled":e.disabled?(this.setDisabled(),this.unWireEvents()):(this.element.disabled=!1,s.classList.remove(A),s.setAttribute("aria-disabled","false"),this.wireEvents());break;case"value":this.element.setAttribute("value",e.value);break;case"name":this.element.setAttribute("name",e.name);break;case"onLabel":case"offLabel":this.setLabel(e.onLabel,e.offLabel);break;case"enableRtl":e.enableRtl?s.classList.add("e-rtl"):s.classList.remove("e-rtl");break;case"cssClass":t.cssClass&&s.classList.remove(t.cssClass),s.classList.add(e.cssClass)}}},s.prototype.preRender=function(){var e=this.element;this.tagName=this.element.tagName,a(this,"EJS-SWITCH",T,e,this.getModuleName())},s.prototype.render=function(){this.initWrapper(),this.initialize(),this.disabled||this.wireEvents()},s.prototype.rippleHandler=function(e){r(e,this.getWrapper().getElementsByClassName(B)[0]),"mousedown"===e.type&&e.currentTarget.classList.contains("e-switch-wrapper")&&1===e.which&&(this.isDrag=!0,this.isKeyPressed=!1)},s.prototype.rippleTouchHandler=function(e){var t=this.getWrapper().getElementsByClassName(B)[0];if(t){var s=document.createEvent("MouseEvents");s.initEvent(e,!1,!0),t.dispatchEvent(s)}},s.prototype.setDisabled=function(){var e=this.getWrapper();this.element.disabled=!0,e.classList.add(A),e.setAttribute("aria-disabled","true")},s.prototype.setLabel=function(e,t){var s=this.getWrapper();e&&(s.querySelector(".e-switch-on").textContent=e),t&&(s.querySelector(".e-switch-off").textContent=t)},s.prototype.switchFocusHandler=function(){this.isKeyPressed=!0},s.prototype.switchMouseUp=function(e){var t=e.target;this.getWrapper().getElementsByClassName(B)[0];"touchmove"===e.type&&e.preventDefault(),"touchstart"===e.type&&(this.isDrag=!0,this.rippleTouchHandler("mousedown")),this.isDrag&&("mouseup"===e.type&&t.className.indexOf("e-switch")<0||"touchend"===e.type)&&(this.clickHandler(e),this.rippleTouchHandler("mouseup"),e.preventDefault())},s.prototype.toggle=function(){this.clickHandler()},s.prototype.wireEvents=function(){var e=this.getWrapper();e.querySelector(".e-switch-handle");t.EventHandler.add(e,"click",this.clickHandler,this),t.EventHandler.add(this.element,"focus",this.focusHandler,this),t.EventHandler.add(this.element,"focusout",this.focusOutHandler,this),t.EventHandler.add(document,"mouseup",this.switchMouseUp,this),t.EventHandler.add(document,"keydown",this.switchFocusHandler,this),t.EventHandler.add(e,"mousedown mouseup",this.rippleHandler,this),t.EventHandler.add(e,"touchstart touchmove touchend",this.switchMouseUp,this)},s.prototype.unWireEvents=function(){var e=this.getWrapper();e.querySelector(".e-switch-handle");t.EventHandler.remove(e,"click",this.clickHandler),t.EventHandler.remove(this.element,"focus",this.focusHandler),t.EventHandler.remove(this.element,"focusout",this.focusOutHandler),t.EventHandler.remove(document,"mouseup",this.switchMouseUp),t.EventHandler.remove(document,"keydown",this.switchFocusHandler),t.EventHandler.remove(e,"mousedown mouseup",this.rippleHandler),t.EventHandler.remove(e,"touchstart touchmove touchend",this.switchMouseUp)},W([t.Event()],s.prototype,"change",void 0),W([t.Property(!1)],s.prototype,"checked",void 0),W([t.Property("")],s.prototype,"cssClass",void 0),W([t.Property(!1)],s.prototype,"disabled",void 0),W([t.Property("")],s.prototype,"name",void 0),W([t.Property("")],s.prototype,"onLabel",void 0),W([t.Property("")],s.prototype,"offLabel",void 0),W([t.Property("")],s.prototype,"value",void 0),s=W([t.NotifyPropertyChanges],s)}(t.Component);e.wrapperInitialize=s,e.getTextNode=i,e.destroy=n,e.preRender=a,e.createCheckBox=function(e,s){void 0===e&&(e=!1),void 0===s&&(s={});var i=t.createElement("div",{className:"e-checkbox-wrapper e-css"});if(s.cssClass&&t.addClass([i],s.cssClass.split(" ")),s.enableRtl&&i.classList.add("e-rtl"),e){var n=t.createElement("span",{className:"e-ripple-container"});t.rippleEffect(n,{isCenterRipple:!0,duration:400}),i.appendChild(n)}var a=t.createElement("span",{className:"e-frame e-icons"});if(s.checked&&a.classList.add("e-check"),i.appendChild(a),s.label){var r=t.createElement("span",{className:"e-label",innerHTML:s.label});i.appendChild(r)}return i},e.rippleMouseHandler=r,e.Button=u,e.CheckBox=C,e.RadioButton=O,e.Switch=x,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ej2-buttons.umd.min.js.map

@@ -7,3 +7,3 @@ import { Component, Event, EventHandler, NotifyPropertyChanges, Property, addClass, createElement, detach, getInstance, getUniqueID, getValue, isRippleEnabled, removeClass, rippleEffect, setValue } from '@syncfusion/ej2-base';

*/
function wrapperInitialize(tag, type, element, WRAPPER) {
function wrapperInitialize(tag, type, element, WRAPPER, role) {
if (element.tagName === tag) {

@@ -14,3 +14,3 @@ let ejInstance = getValue('ej2_instances', element);

let wrapper = createElement(tag, {
className: WRAPPER, attrs: { 'role': type, 'aria-checked': 'false' }
className: WRAPPER, attrs: { 'role': role, 'aria-checked': 'false' }
});

@@ -43,2 +43,35 @@ for (let index = 0, len = element.attributes.length; index < len; index++) {

/**
* Destroy the button components.
* @private
*/
function destroy(ejInst, wrapper, tagName) {
if (tagName === 'INPUT') {
wrapper.parentNode.insertBefore(ejInst.element, wrapper);
detach(wrapper);
ejInst.element.checked = false;
['name', 'value', 'disabled'].forEach((key) => {
ejInst.element.removeAttribute(key);
});
}
else {
if (ejInst.element.id) {
wrapper.setAttribute('id', ejInst.element.id);
}
['role', 'aria-checked', 'class'].forEach((key) => {
wrapper.removeAttribute(key);
});
wrapper.innerHTML = '';
}
}
function preRender(proxy, control, wrapper, element, moduleName) {
element = wrapperInitialize(control, 'checkbox', element, wrapper, moduleName);
proxy.element = element;
if (proxy.element.getAttribute('type') !== 'checkbox') {
proxy.element.setAttribute('type', 'checkbox');
}
if (!proxy.element.id) {
proxy.element.id = getUniqueID('e-' + moduleName);
}
}
/**
* Creates CheckBox component UI with theming and ripple support.

@@ -147,3 +180,3 @@ * @private

}
rippleEffect(this.element, { selector: '.' + cssClassName.BUTTON });
this.removeRippleEffect = rippleEffect(this.element, { selector: '.' + cssClassName.BUTTON });
}

@@ -210,2 +243,3 @@ controlStatus(disabled) {

this.unWireEvents();
this.removeRippleEffect();
}

@@ -624,3 +658,3 @@ /**

this.tagName = this.element.tagName;
element = wrapperInitialize('EJS-CHECKBOX', 'checkbox', element, WRAPPER);
element = wrapperInitialize('EJS-CHECKBOX', 'checkbox', element, WRAPPER, 'checkbox');
this.element = element;

@@ -939,3 +973,3 @@ if (this.element.getAttribute('type') !== 'checkbox') {

this.tagName = this.element.tagName;
element = wrapperInitialize('EJS-RADIOBUTTON', 'radio', element, WRAPPER$1);
element = wrapperInitialize('EJS-RADIOBUTTON', 'radio', element, WRAPPER$1, 'radio');
this.element = element;

@@ -1039,7 +1073,342 @@ if (this.element.getAttribute('type') !== 'radio') {

var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
const DISABLED$1 = 'e-switch-disabled';
const RIPPLE$2 = 'e-ripple-container';
const RIPPLE_CHECK = 'e-ripple-check';
const RTL$2 = 'e-rtl';
const WRAPPER$2 = 'e-switch-wrapper';
const ACTIVE = 'e-switch-active';
/**
* The Switch is a graphical user interface element that allows you to toggle between checked and unchecked states.
* ```html
* <input type="checkbox" id="switch"/>
* <script>
* var switchObj = new Switch({});
* switchObj.appendTo("#switch");
* </script>
* ```
*/
let Switch = class Switch extends Component {
/**
* Constructor for creating the widget.
* @private
*/
constructor(options, element) {
super(options, element);
this.isKeyPressed = false;
this.isDrag = false;
}
changeState(state) {
let ariaState;
let rippleSpan;
let wrapper = this.getWrapper();
let bar = wrapper.querySelector('.e-switch-inner');
let handle = wrapper.querySelector('.e-switch-handle');
if (isRippleEnabled) {
rippleSpan = wrapper.getElementsByClassName(RIPPLE$2)[0];
}
if (state) {
addClass([bar, handle], ACTIVE);
ariaState = 'true';
this.element.checked = true;
this.checked = true;
if (rippleSpan) {
addClass([rippleSpan], [RIPPLE_CHECK]);
}
}
else {
removeClass([bar, handle], ACTIVE);
ariaState = 'false';
this.element.checked = false;
this.checked = false;
if (rippleSpan) {
removeClass([rippleSpan], [RIPPLE_CHECK]);
}
}
wrapper.setAttribute('aria-checked', ariaState);
}
clickHandler(evt) {
this.isDrag = false;
this.focusOutHandler();
this.changeState(!this.checked);
this.element.focus();
let changeEventArgs = { checked: this.element.checked, event: evt };
this.trigger('change', changeEventArgs);
}
/**
* Destroys the Switch widget.
* @returns void
*/
destroy() {
super.destroy();
if (!this.disabled) {
this.unWireEvents();
}
destroy(this, this.getWrapper(), this.tagName);
}
focusHandler() {
if (this.isKeyPressed) {
this.getWrapper().classList.add('e-focus');
}
}
focusOutHandler() {
this.getWrapper().classList.remove('e-focus');
}
/**
* Gets the module name.
* @private
*/
getModuleName() {
return 'switch';
}
/**
* Gets the properties to be maintained in the persistence state.
* @private
*/
getPersistData() {
return this.addOnPersist(['checked']);
}
getWrapper() {
return this.element.parentElement;
}
initialize() {
if (this.name) {
this.element.setAttribute('name', this.name);
}
if (this.value) {
this.element.setAttribute('value', this.value);
}
if (this.checked) {
this.changeState(true);
}
if (this.disabled) {
this.setDisabled();
}
if (this.onLabel || this.offLabel) {
this.setLabel(this.onLabel, this.offLabel);
}
}
initWrapper() {
let wrapper = this.element.parentElement;
if (!wrapper.classList.contains(WRAPPER$2)) {
wrapper = createElement('div', {
className: WRAPPER$2, attrs: { 'role': 'switch', 'aria-checked': 'false' }
});
this.element.parentNode.insertBefore(wrapper, this.element);
}
let switchInner = createElement('span', { className: 'e-switch-inner' });
let onLabel = createElement('span', { className: 'e-switch-on' });
let offLabel = createElement('span', { className: 'e-switch-off' });
let handle = createElement('span', { className: 'e-switch-handle' });
wrapper.appendChild(this.element);
switchInner.appendChild(onLabel);
switchInner.appendChild(offLabel);
wrapper.appendChild(switchInner);
wrapper.appendChild(handle);
if (isRippleEnabled) {
let rippleSpan = createElement('span', { className: RIPPLE$2 });
handle.appendChild(rippleSpan);
rippleEffect(rippleSpan, { duration: 400, isCenterRipple: true });
}
if (this.enableRtl) {
wrapper.classList.add(RTL$2);
}
if (this.cssClass) {
addClass([wrapper], this.cssClass.split(' '));
}
}
/**
* Called internally if any of the property value changes.
* @private
*/
onPropertyChanged(newProp, oldProp) {
let wrapper = this.getWrapper();
for (let prop of Object.keys(newProp)) {
switch (prop) {
case 'checked':
this.changeState(newProp.checked);
break;
case 'disabled':
if (newProp.disabled) {
this.setDisabled();
this.unWireEvents();
}
else {
this.element.disabled = false;
wrapper.classList.remove(DISABLED$1);
wrapper.setAttribute('aria-disabled', 'false');
this.wireEvents();
}
break;
case 'value':
this.element.setAttribute('value', newProp.value);
break;
case 'name':
this.element.setAttribute('name', newProp.name);
break;
case 'onLabel':
case 'offLabel':
this.setLabel(newProp.onLabel, newProp.offLabel);
break;
case 'enableRtl':
if (newProp.enableRtl) {
wrapper.classList.add(RTL$2);
}
else {
wrapper.classList.remove(RTL$2);
}
break;
case 'cssClass':
if (oldProp.cssClass) {
wrapper.classList.remove(oldProp.cssClass);
}
wrapper.classList.add(newProp.cssClass);
break;
}
}
}
/**
* Initialize Angular, React and Unique ID support.
* @private
*/
preRender() {
let element = this.element;
this.tagName = this.element.tagName;
preRender(this, 'EJS-SWITCH', WRAPPER$2, element, this.getModuleName());
}
/**
* Initialize control rendering.
* @private
*/
render() {
this.initWrapper();
this.initialize();
if (!this.disabled) {
this.wireEvents();
}
}
rippleHandler(e) {
let rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE$2)[0];
rippleMouseHandler(e, rippleSpan);
if (e.type === 'mousedown' && e.currentTarget.classList.contains('e-switch-wrapper') && e.which === 1) {
this.isDrag = true;
this.isKeyPressed = false;
}
}
rippleTouchHandler(eventType) {
let rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE$2)[0];
if (rippleSpan) {
let event = document.createEvent('MouseEvents');
event.initEvent(eventType, false, true);
rippleSpan.dispatchEvent(event);
}
}
setDisabled() {
let wrapper = this.getWrapper();
this.element.disabled = true;
wrapper.classList.add(DISABLED$1);
wrapper.setAttribute('aria-disabled', 'true');
}
setLabel(onText, offText) {
let wrapper = this.getWrapper();
if (onText) {
wrapper.querySelector('.e-switch-on').textContent = onText;
}
if (offText) {
wrapper.querySelector('.e-switch-off').textContent = offText;
}
}
switchFocusHandler() {
this.isKeyPressed = true;
}
switchMouseUp(e) {
let target = e.target;
let rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE$2)[0];
if (e.type === 'touchmove') {
e.preventDefault();
}
if (e.type === 'touchstart') {
this.isDrag = true;
this.rippleTouchHandler('mousedown');
}
if (this.isDrag) {
if ((e.type === 'mouseup' && target.className.indexOf('e-switch') < 0) || e.type === 'touchend') {
this.clickHandler(e);
this.rippleTouchHandler('mouseup');
e.preventDefault();
}
}
}
/**
* Toggle the Switch component state into checked/unchecked.
* @returns void
*/
toggle() {
this.clickHandler();
}
wireEvents() {
let wrapper = this.getWrapper();
let handle = wrapper.querySelector('.e-switch-handle');
EventHandler.add(wrapper, 'click', this.clickHandler, this);
EventHandler.add(this.element, 'focus', this.focusHandler, this);
EventHandler.add(this.element, 'focusout', this.focusOutHandler, this);
EventHandler.add(document, 'mouseup', this.switchMouseUp, this);
EventHandler.add(document, 'keydown', this.switchFocusHandler, this);
EventHandler.add(wrapper, 'mousedown mouseup', this.rippleHandler, this);
EventHandler.add(wrapper, 'touchstart touchmove touchend', this.switchMouseUp, this);
}
unWireEvents() {
let wrapper = this.getWrapper();
let handle = wrapper.querySelector('.e-switch-handle');
EventHandler.remove(wrapper, 'click', this.clickHandler);
EventHandler.remove(this.element, 'focus', this.focusHandler);
EventHandler.remove(this.element, 'focusout', this.focusOutHandler);
EventHandler.remove(document, 'mouseup', this.switchMouseUp);
EventHandler.remove(document, 'keydown', this.switchFocusHandler);
EventHandler.remove(wrapper, 'mousedown mouseup', this.rippleHandler);
EventHandler.remove(wrapper, 'touchstart touchmove touchend', this.switchMouseUp);
}
};
__decorate$3([
Event()
], Switch.prototype, "change", void 0);
__decorate$3([
Property(false)
], Switch.prototype, "checked", void 0);
__decorate$3([
Property('')
], Switch.prototype, "cssClass", void 0);
__decorate$3([
Property(false)
], Switch.prototype, "disabled", void 0);
__decorate$3([
Property('')
], Switch.prototype, "name", void 0);
__decorate$3([
Property('')
], Switch.prototype, "onLabel", void 0);
__decorate$3([
Property('')
], Switch.prototype, "offLabel", void 0);
__decorate$3([
Property('')
], Switch.prototype, "value", void 0);
Switch = __decorate$3([
NotifyPropertyChanges
], Switch);
/**
* Switch modules
*/
/**
* Button all modules
*/
export { wrapperInitialize, getTextNode, createCheckBox, rippleMouseHandler, Button, CheckBox, RadioButton };
export { wrapperInitialize, getTextNode, destroy, preRender, createCheckBox, rippleMouseHandler, Button, CheckBox, RadioButton, Switch };
//# sourceMappingURL=ej2-buttons.es2015.js.map

@@ -7,3 +7,3 @@ import { Component, Event, EventHandler, NotifyPropertyChanges, Property, addClass, createElement, detach, getInstance, getUniqueID, getValue, isRippleEnabled, removeClass, rippleEffect, setValue } from '@syncfusion/ej2-base';

*/
function wrapperInitialize(tag, type, element, WRAPPER) {
function wrapperInitialize(tag, type, element, WRAPPER, role) {
if (element.tagName === tag) {

@@ -14,3 +14,3 @@ var ejInstance = getValue('ej2_instances', element);

var wrapper = createElement(tag, {
className: WRAPPER, attrs: { 'role': type, 'aria-checked': 'false' }
className: WRAPPER, attrs: { 'role': role, 'aria-checked': 'false' }
});

@@ -43,2 +43,35 @@ for (var index = 0, len = element.attributes.length; index < len; index++) {

/**
* Destroy the button components.
* @private
*/
function destroy(ejInst, wrapper, tagName) {
if (tagName === 'INPUT') {
wrapper.parentNode.insertBefore(ejInst.element, wrapper);
detach(wrapper);
ejInst.element.checked = false;
['name', 'value', 'disabled'].forEach(function (key) {
ejInst.element.removeAttribute(key);
});
}
else {
if (ejInst.element.id) {
wrapper.setAttribute('id', ejInst.element.id);
}
['role', 'aria-checked', 'class'].forEach(function (key) {
wrapper.removeAttribute(key);
});
wrapper.innerHTML = '';
}
}
function preRender(proxy, control, wrapper, element, moduleName) {
element = wrapperInitialize(control, 'checkbox', element, wrapper, moduleName);
proxy.element = element;
if (proxy.element.getAttribute('type') !== 'checkbox') {
proxy.element.setAttribute('type', 'checkbox');
}
if (!proxy.element.id) {
proxy.element.id = getUniqueID('e-' + moduleName);
}
}
/**
* Creates CheckBox component UI with theming and ripple support.

@@ -160,3 +193,3 @@ * @private

}
rippleEffect(this.element, { selector: '.' + cssClassName.BUTTON });
this.removeRippleEffect = rippleEffect(this.element, { selector: '.' + cssClassName.BUTTON });
};

@@ -223,2 +256,3 @@ Button.prototype.controlStatus = function (disabled) {

this.unWireEvents();
this.removeRippleEffect();
};

@@ -653,3 +687,3 @@ /**

this.tagName = this.element.tagName;
element = wrapperInitialize('EJS-CHECKBOX', 'checkbox', element, WRAPPER);
element = wrapperInitialize('EJS-CHECKBOX', 'checkbox', element, WRAPPER, 'checkbox');
this.element = element;

@@ -984,3 +1018,3 @@ if (this.element.getAttribute('type') !== 'checkbox') {

this.tagName = this.element.tagName;
element = wrapperInitialize('EJS-RADIOBUTTON', 'radio', element, WRAPPER$1);
element = wrapperInitialize('EJS-RADIOBUTTON', 'radio', element, WRAPPER$1, 'radio');
this.element = element;

@@ -1085,7 +1119,356 @@ if (this.element.getAttribute('type') !== 'radio') {

var __extends$3 = (undefined && undefined.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var DISABLED$1 = 'e-switch-disabled';
var RIPPLE$2 = 'e-ripple-container';
var RIPPLE_CHECK = 'e-ripple-check';
var RTL$2 = 'e-rtl';
var WRAPPER$2 = 'e-switch-wrapper';
var ACTIVE = 'e-switch-active';
/**
* The Switch is a graphical user interface element that allows you to toggle between checked and unchecked states.
* ```html
* <input type="checkbox" id="switch"/>
* <script>
* var switchObj = new Switch({});
* switchObj.appendTo("#switch");
* </script>
* ```
*/
var Switch = /** @__PURE__ @class */ (function (_super) {
__extends$3(Switch, _super);
/**
* Constructor for creating the widget.
* @private
*/
function Switch(options, element) {
var _this = _super.call(this, options, element) || this;
_this.isKeyPressed = false;
_this.isDrag = false;
return _this;
}
Switch.prototype.changeState = function (state) {
var ariaState;
var rippleSpan;
var wrapper = this.getWrapper();
var bar = wrapper.querySelector('.e-switch-inner');
var handle = wrapper.querySelector('.e-switch-handle');
if (isRippleEnabled) {
rippleSpan = wrapper.getElementsByClassName(RIPPLE$2)[0];
}
if (state) {
addClass([bar, handle], ACTIVE);
ariaState = 'true';
this.element.checked = true;
this.checked = true;
if (rippleSpan) {
addClass([rippleSpan], [RIPPLE_CHECK]);
}
}
else {
removeClass([bar, handle], ACTIVE);
ariaState = 'false';
this.element.checked = false;
this.checked = false;
if (rippleSpan) {
removeClass([rippleSpan], [RIPPLE_CHECK]);
}
}
wrapper.setAttribute('aria-checked', ariaState);
};
Switch.prototype.clickHandler = function (evt) {
this.isDrag = false;
this.focusOutHandler();
this.changeState(!this.checked);
this.element.focus();
var changeEventArgs = { checked: this.element.checked, event: evt };
this.trigger('change', changeEventArgs);
};
/**
* Destroys the Switch widget.
* @returns void
*/
Switch.prototype.destroy = function () {
_super.prototype.destroy.call(this);
if (!this.disabled) {
this.unWireEvents();
}
destroy(this, this.getWrapper(), this.tagName);
};
Switch.prototype.focusHandler = function () {
if (this.isKeyPressed) {
this.getWrapper().classList.add('e-focus');
}
};
Switch.prototype.focusOutHandler = function () {
this.getWrapper().classList.remove('e-focus');
};
/**
* Gets the module name.
* @private
*/
Switch.prototype.getModuleName = function () {
return 'switch';
};
/**
* Gets the properties to be maintained in the persistence state.
* @private
*/
Switch.prototype.getPersistData = function () {
return this.addOnPersist(['checked']);
};
Switch.prototype.getWrapper = function () {
return this.element.parentElement;
};
Switch.prototype.initialize = function () {
if (this.name) {
this.element.setAttribute('name', this.name);
}
if (this.value) {
this.element.setAttribute('value', this.value);
}
if (this.checked) {
this.changeState(true);
}
if (this.disabled) {
this.setDisabled();
}
if (this.onLabel || this.offLabel) {
this.setLabel(this.onLabel, this.offLabel);
}
};
Switch.prototype.initWrapper = function () {
var wrapper = this.element.parentElement;
if (!wrapper.classList.contains(WRAPPER$2)) {
wrapper = createElement('div', {
className: WRAPPER$2, attrs: { 'role': 'switch', 'aria-checked': 'false' }
});
this.element.parentNode.insertBefore(wrapper, this.element);
}
var switchInner = createElement('span', { className: 'e-switch-inner' });
var onLabel = createElement('span', { className: 'e-switch-on' });
var offLabel = createElement('span', { className: 'e-switch-off' });
var handle = createElement('span', { className: 'e-switch-handle' });
wrapper.appendChild(this.element);
switchInner.appendChild(onLabel);
switchInner.appendChild(offLabel);
wrapper.appendChild(switchInner);
wrapper.appendChild(handle);
if (isRippleEnabled) {
var rippleSpan = createElement('span', { className: RIPPLE$2 });
handle.appendChild(rippleSpan);
rippleEffect(rippleSpan, { duration: 400, isCenterRipple: true });
}
if (this.enableRtl) {
wrapper.classList.add(RTL$2);
}
if (this.cssClass) {
addClass([wrapper], this.cssClass.split(' '));
}
};
/**
* Called internally if any of the property value changes.
* @private
*/
Switch.prototype.onPropertyChanged = function (newProp, oldProp) {
var wrapper = this.getWrapper();
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
var prop = _a[_i];
switch (prop) {
case 'checked':
this.changeState(newProp.checked);
break;
case 'disabled':
if (newProp.disabled) {
this.setDisabled();
this.unWireEvents();
}
else {
this.element.disabled = false;
wrapper.classList.remove(DISABLED$1);
wrapper.setAttribute('aria-disabled', 'false');
this.wireEvents();
}
break;
case 'value':
this.element.setAttribute('value', newProp.value);
break;
case 'name':
this.element.setAttribute('name', newProp.name);
break;
case 'onLabel':
case 'offLabel':
this.setLabel(newProp.onLabel, newProp.offLabel);
break;
case 'enableRtl':
if (newProp.enableRtl) {
wrapper.classList.add(RTL$2);
}
else {
wrapper.classList.remove(RTL$2);
}
break;
case 'cssClass':
if (oldProp.cssClass) {
wrapper.classList.remove(oldProp.cssClass);
}
wrapper.classList.add(newProp.cssClass);
break;
}
}
};
/**
* Initialize Angular, React and Unique ID support.
* @private
*/
Switch.prototype.preRender = function () {
var element = this.element;
this.tagName = this.element.tagName;
preRender(this, 'EJS-SWITCH', WRAPPER$2, element, this.getModuleName());
};
/**
* Initialize control rendering.
* @private
*/
Switch.prototype.render = function () {
this.initWrapper();
this.initialize();
if (!this.disabled) {
this.wireEvents();
}
};
Switch.prototype.rippleHandler = function (e) {
var rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE$2)[0];
rippleMouseHandler(e, rippleSpan);
if (e.type === 'mousedown' && e.currentTarget.classList.contains('e-switch-wrapper') && e.which === 1) {
this.isDrag = true;
this.isKeyPressed = false;
}
};
Switch.prototype.rippleTouchHandler = function (eventType) {
var rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE$2)[0];
if (rippleSpan) {
var event_1 = document.createEvent('MouseEvents');
event_1.initEvent(eventType, false, true);
rippleSpan.dispatchEvent(event_1);
}
};
Switch.prototype.setDisabled = function () {
var wrapper = this.getWrapper();
this.element.disabled = true;
wrapper.classList.add(DISABLED$1);
wrapper.setAttribute('aria-disabled', 'true');
};
Switch.prototype.setLabel = function (onText, offText) {
var wrapper = this.getWrapper();
if (onText) {
wrapper.querySelector('.e-switch-on').textContent = onText;
}
if (offText) {
wrapper.querySelector('.e-switch-off').textContent = offText;
}
};
Switch.prototype.switchFocusHandler = function () {
this.isKeyPressed = true;
};
Switch.prototype.switchMouseUp = function (e) {
var target = e.target;
var rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE$2)[0];
if (e.type === 'touchmove') {
e.preventDefault();
}
if (e.type === 'touchstart') {
this.isDrag = true;
this.rippleTouchHandler('mousedown');
}
if (this.isDrag) {
if ((e.type === 'mouseup' && target.className.indexOf('e-switch') < 0) || e.type === 'touchend') {
this.clickHandler(e);
this.rippleTouchHandler('mouseup');
e.preventDefault();
}
}
};
/**
* Toggle the Switch component state into checked/unchecked.
* @returns void
*/
Switch.prototype.toggle = function () {
this.clickHandler();
};
Switch.prototype.wireEvents = function () {
var wrapper = this.getWrapper();
var handle = wrapper.querySelector('.e-switch-handle');
EventHandler.add(wrapper, 'click', this.clickHandler, this);
EventHandler.add(this.element, 'focus', this.focusHandler, this);
EventHandler.add(this.element, 'focusout', this.focusOutHandler, this);
EventHandler.add(document, 'mouseup', this.switchMouseUp, this);
EventHandler.add(document, 'keydown', this.switchFocusHandler, this);
EventHandler.add(wrapper, 'mousedown mouseup', this.rippleHandler, this);
EventHandler.add(wrapper, 'touchstart touchmove touchend', this.switchMouseUp, this);
};
Switch.prototype.unWireEvents = function () {
var wrapper = this.getWrapper();
var handle = wrapper.querySelector('.e-switch-handle');
EventHandler.remove(wrapper, 'click', this.clickHandler);
EventHandler.remove(this.element, 'focus', this.focusHandler);
EventHandler.remove(this.element, 'focusout', this.focusOutHandler);
EventHandler.remove(document, 'mouseup', this.switchMouseUp);
EventHandler.remove(document, 'keydown', this.switchFocusHandler);
EventHandler.remove(wrapper, 'mousedown mouseup', this.rippleHandler);
EventHandler.remove(wrapper, 'touchstart touchmove touchend', this.switchMouseUp);
};
__decorate$3([
Event()
], Switch.prototype, "change", void 0);
__decorate$3([
Property(false)
], Switch.prototype, "checked", void 0);
__decorate$3([
Property('')
], Switch.prototype, "cssClass", void 0);
__decorate$3([
Property(false)
], Switch.prototype, "disabled", void 0);
__decorate$3([
Property('')
], Switch.prototype, "name", void 0);
__decorate$3([
Property('')
], Switch.prototype, "onLabel", void 0);
__decorate$3([
Property('')
], Switch.prototype, "offLabel", void 0);
__decorate$3([
Property('')
], Switch.prototype, "value", void 0);
Switch = __decorate$3([
NotifyPropertyChanges
], Switch);
return Switch;
}(Component));
/**
* Switch modules
*/
/**
* Button all modules
*/
export { wrapperInitialize, getTextNode, createCheckBox, rippleMouseHandler, Button, CheckBox, RadioButton };
export { wrapperInitialize, getTextNode, destroy, preRender, createCheckBox, rippleMouseHandler, Button, CheckBox, RadioButton, Switch };
//# sourceMappingURL=ej2-buttons.es5.js.map

@@ -1,10 +0,1 @@

/*!
* filename: index.d.ts
* version : 16.1.48
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
import * as _buttons from '@syncfusion/ej2-buttons';

@@ -11,0 +2,0 @@ import * as _base from '@syncfusion/ej2-base';

{
"name": "@syncfusion/ej2-buttons",
"version": "16.1.48",
"version": "16.2.41",
"description": "Essential JS 2 Button Components",

@@ -11,3 +11,3 @@ "author": "Syncfusion Inc.",

"dependencies": {
"@syncfusion/ej2-base": "~16.1.38"
"@syncfusion/ej2-base": "~16.2.41"
},

@@ -14,0 +14,0 @@ "devDependencies": {

# Overview
A package of Essential JS 2 Button, CheckBox and RadioButton components. It comes with documentation and support, which is available under commercial and community licenses. Please visit www.syncfusion.com to get started.
A package of Essential JS 2 Button, CheckBox, RadioButton and Switch components. It comes with documentation and support, which is available under commercial and community licenses. Please visit www.syncfusion.com to get started.

@@ -12,2 +12,4 @@ ## Resources

* [RadioButton Demo](http://ej2.syncfusion.com/demos/#/material/button/radio-button.html)
* [RadioButton Documentation](http://ej2.syncfusion.com/documentation/radio-button)
* [RadioButton Documentation](http://ej2.syncfusion.com/documentation/radio-button)
* [Switch Demo](http://ej2.syncfusion.com/demos/#/material/button/switch.html)
* [Switch Documentation](http://ej2.syncfusion.com/documentation/switch)

@@ -17,2 +17,3 @@ import { INotifyPropertyChanged, Component } from '@syncfusion/ej2-base';

export declare class Button extends Component<HTMLButtonElement> implements INotifyPropertyChanged {
private removeRippleEffect;
/**

@@ -19,0 +20,0 @@ * Positions the icon before/after the text content in the Button.

@@ -56,3 +56,3 @@ var __extends = (this && this.__extends) || (function () {

}
ej2_base_2.rippleEffect(this.element, { selector: '.' + cssClassName.BUTTON });
this.removeRippleEffect = ej2_base_2.rippleEffect(this.element, { selector: '.' + cssClassName.BUTTON });
};

@@ -115,2 +115,3 @@ Button.prototype.controlStatus = function (disabled) {

this.unWireEvents();
this.removeRippleEffect();
};

@@ -117,0 +118,0 @@ Button.prototype.getModuleName = function () {

@@ -1,3 +0,3 @@

import { Component, INotifyPropertyChanged , NotifyPropertyChanges, Property } from '@syncfusion/ej2-base';import { BaseEventArgs, EmitType, Event, EventHandler, KeyboardEvents } from '@syncfusion/ej2-base';import { addClass, createElement, detach, getUniqueID, isRippleEnabled, removeClass, rippleEffect } from '@syncfusion/ej2-base';import { wrapperInitialize, rippleMouseHandler } from './../common/common';
import {ChangeEventArgs,LabelPosition} from "./check-box";
import { Component, INotifyPropertyChanged , NotifyPropertyChanges, Property } from '@syncfusion/ej2-base';import { EmitType, Event, EventHandler, KeyboardEvents } from '@syncfusion/ej2-base';import { addClass, createElement, detach, getUniqueID, isRippleEnabled, removeClass, rippleEffect } from '@syncfusion/ej2-base';import { wrapperInitialize, rippleMouseHandler, ChangeEventArgs } from './../common/common';
import {LabelPosition} from "./check-box";
import {ComponentModel} from '@syncfusion/ej2-base';

@@ -4,0 +4,0 @@

import { Component, INotifyPropertyChanged } from '@syncfusion/ej2-base';
import { BaseEventArgs, EmitType } from '@syncfusion/ej2-base';
import { EmitType } from '@syncfusion/ej2-base';
import { CheckBoxModel } from './check-box-model';
import { ChangeEventArgs } from './../common/common';
export declare type LabelPosition = 'After' | 'Before';

@@ -124,7 +125,1 @@ /**

}
export interface ChangeEventArgs extends BaseEventArgs {
/** Returns the event parameters of the CheckBox. */
event?: Event;
/** Returns the checked value of the CheckBox. */
checked?: boolean;
}

@@ -268,3 +268,3 @@ var __extends = (this && this.__extends) || (function () {

this.tagName = this.element.tagName;
element = common_1.wrapperInitialize('EJS-CHECKBOX', 'checkbox', element, WRAPPER);
element = common_1.wrapperInitialize('EJS-CHECKBOX', 'checkbox', element, WRAPPER, 'checkbox');
this.element = element;

@@ -271,0 +271,0 @@ if (this.element.getAttribute('type') !== 'checkbox') {

@@ -0,1 +1,4 @@

import { BaseEventArgs } from '@syncfusion/ej2-base';
import { CheckBox } from '../check-box';
import { Switch } from '../switch';
/**

@@ -5,5 +8,11 @@ * Initialize wrapper element for angular.

*/
export declare function wrapperInitialize(tag: string, type: string, element: HTMLInputElement, WRAPPER: string): HTMLInputElement;
export declare function wrapperInitialize(tag: string, type: string, element: HTMLInputElement, WRAPPER: string, role: string): HTMLInputElement;
export declare function getTextNode(element: HTMLElement): Node;
/**
* Destroy the button components.
* @private
*/
export declare function destroy(ejInst: Switch | CheckBox, wrapper: Element, tagName: string): void;
export declare function preRender(proxy: Switch | CheckBox, control: string, wrapper: string, element: HTMLInputElement, moduleName: string): void;
/**
* Creates CheckBox component UI with theming and ripple support.

@@ -20,1 +29,7 @@ * @private

}
export interface ChangeEventArgs extends BaseEventArgs {
/** Returns the event parameters of the CheckBox or Switch. */
event?: Event;
/** Returns the checked value of the CheckBox or Switch. */
checked?: boolean;
}
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base"], function (require, exports, ej2_base_1, ej2_base_2) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function wrapperInitialize(tag, type, element, WRAPPER) {
function wrapperInitialize(tag, type, element, WRAPPER, role) {
if (element.tagName === tag) {

@@ -10,3 +10,3 @@ var ejInstance = ej2_base_2.getValue('ej2_instances', element);

var wrapper = ej2_base_1.createElement(tag, {
className: WRAPPER, attrs: { 'role': type, 'aria-checked': 'false' }
className: WRAPPER, attrs: { 'role': role, 'aria-checked': 'false' }
});

@@ -40,2 +40,33 @@ for (var index = 0, len = element.attributes.length; index < len; index++) {

exports.getTextNode = getTextNode;
function destroy(ejInst, wrapper, tagName) {
if (tagName === 'INPUT') {
wrapper.parentNode.insertBefore(ejInst.element, wrapper);
ej2_base_1.detach(wrapper);
ejInst.element.checked = false;
['name', 'value', 'disabled'].forEach(function (key) {
ejInst.element.removeAttribute(key);
});
}
else {
if (ejInst.element.id) {
wrapper.setAttribute('id', ejInst.element.id);
}
['role', 'aria-checked', 'class'].forEach(function (key) {
wrapper.removeAttribute(key);
});
wrapper.innerHTML = '';
}
}
exports.destroy = destroy;
function preRender(proxy, control, wrapper, element, moduleName) {
element = wrapperInitialize(control, 'checkbox', element, wrapper, moduleName);
proxy.element = element;
if (proxy.element.getAttribute('type') !== 'checkbox') {
proxy.element.setAttribute('type', 'checkbox');
}
if (!proxy.element.id) {
proxy.element.id = ej2_base_1.getUniqueID('e-' + moduleName);
}
}
exports.preRender = preRender;
function createCheckBox(enableRipple, options) {

@@ -42,0 +73,0 @@ if (enableRipple === void 0) { enableRipple = false; }

@@ -8,1 +8,2 @@ /**

export * from './radio-button/index';
export * from './switch/index';

@@ -1,2 +0,2 @@

define(["require", "exports", "./common/index", "./button/index", "./check-box/index", "./radio-button/index"], function (require, exports, index_1, index_2, index_3, index_4) {
define(["require", "exports", "./common/index", "./button/index", "./check-box/index", "./radio-button/index", "./switch/index"], function (require, exports, index_1, index_2, index_3, index_4, index_5) {
"use strict";

@@ -11,2 +11,3 @@ function __export(m) {

__export(index_4);
__export(index_5);
});

@@ -202,3 +202,3 @@ var __extends = (this && this.__extends) || (function () {

this.tagName = this.element.tagName;
element = common_1.wrapperInitialize('EJS-RADIOBUTTON', 'radio', element, WRAPPER);
element = common_1.wrapperInitialize('EJS-RADIOBUTTON', 'radio', element, WRAPPER, 'radio');
this.element = element;

@@ -205,0 +205,0 @@ if (this.element.getAttribute('type') !== 'radio') {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc