UNPKG

jqwidgets-scripts-custom

Version:

jQWidgets is an advanced jQuery, Angular 7, Vue, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.

4 lines (3 loc) 6.35 kB
require('../../jqwidgets/jqxcore'); require('../../jqwidgets/jqxswitchbutton'); !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms")):"function"==typeof define&&define.amd?define("jqwidgets-ng/jqxswitchbutton",["exports","@angular/core","@angular/forms"],e):e((t["jqwidgets-ng"]=t["jqwidgets-ng"]||{},t["jqwidgets-ng"].jqxswitchbutton={}),t.ng.core,t.ng.forms)}(this,function(t,e,n){"use strict";function s(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,o,s=n.call(t),h=[];try{for(;(void 0===e||0<e--)&&!(i=s.next()).done;)h.push(i.value)}catch(r){o={error:r}}finally{try{i&&!i.done&&(n=s["return"])&&n.call(s)}finally{if(o)throw o.error}}return h}var i=function(){},o={provide:n.NG_VALUE_ACCESSOR,useExisting:e.forwardRef(function(){return h}),multi:!0},h=function(){function t(t){this.autoCreate=!0,this.properties=["checked","disabled","height","orientation","onLabel","offLabel","thumbSize","rtl","width"],this.onTouchedCallback=i,this.onChangeCallback=i,this.onChecked=new e.EventEmitter,this.onChange=new e.EventEmitter,this.onUnchecked=new e.EventEmitter,this.elementRef=t}return t.prototype.ngOnInit=function(){this.autoCreate&&this.createComponent()},t.prototype.ngOnChanges=function(t){if(this.host)for(var e=0;e<this.properties.length;e++){var n="attr"+this.properties[e].substring(0,1).toUpperCase()+this.properties[e].substring(1),i=!1;if(this[n]!==undefined){if("object"==typeof this[n]){if(this[n]instanceof Array&&(i=this.arraysEqual(this[n],this.host.jqxSwitchButton(this.properties[e]))),i)return!1;this.host.jqxSwitchButton(this.properties[e],this[n]);continue}this[n]!==this.host.jqxSwitchButton(this.properties[e])&&this.host.jqxSwitchButton(this.properties[e],this[n])}}},t.prototype.arraysEqual=function(t,e){if(t&&!e||!t&&e)return!1;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0},t.prototype.manageAttributes=function(){for(var t={},e=0;e<this.properties.length;e++){var n="attr"+this.properties[e].substring(0,1).toUpperCase()+this.properties[e].substring(1);this[n]!==undefined&&(t[this.properties[e]]=this[n])}return t},t.prototype.moveClasses=function(t,e){var n,i=t.classList;0<i.length&&(n=e.classList).add.apply(n,function o(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(s(arguments[e]));return t}(i)),t.className=""},t.prototype.moveStyles=function(t,e){var n=t.style.cssText;e.style.cssText=n,t.style.cssText=""},t.prototype.createComponent=function(t){this.host||(t?JQXLite.extend(t,this.manageAttributes()):t=this.manageAttributes(),this.host=JQXLite(this.elementRef.nativeElement.firstChild),this.moveClasses(this.elementRef.nativeElement,this.host[0]),this.moveStyles(this.elementRef.nativeElement,this.host[0]),this.__wireEvents__(),this.widgetObject=jqwidgets.createInstance(this.host,"jqxSwitchButton",t))},t.prototype.createWidget=function(t){this.createComponent(t)},t.prototype.__updateRect__=function(){this.host&&this.host.css({width:this.attrWidth,height:this.attrHeight})},t.prototype.writeValue=function(t){this.widgetObject&&this.onChangeCallback(this.host.val())},t.prototype.registerOnChange=function(t){this.onChangeCallback=t},t.prototype.registerOnTouched=function(t){this.onTouchedCallback=t},t.prototype.setOptions=function(t){this.host.jqxSwitchButton("setOptions",t)},t.prototype.checked=function(t){if(t===undefined)return this.host.jqxSwitchButton("checked");this.host.jqxSwitchButton("checked",t)},t.prototype.disabled=function(t){if(t===undefined)return this.host.jqxSwitchButton("disabled");this.host.jqxSwitchButton("disabled",t)},t.prototype.height=function(t){if(t===undefined)return this.host.jqxSwitchButton("height");this.host.jqxSwitchButton("height",t)},t.prototype.orientation=function(t){if(t===undefined)return this.host.jqxSwitchButton("orientation");this.host.jqxSwitchButton("orientation",t)},t.prototype.onLabel=function(t){if(t===undefined)return this.host.jqxSwitchButton("onLabel");this.host.jqxSwitchButton("onLabel",t)},t.prototype.offLabel=function(t){if(t===undefined)return this.host.jqxSwitchButton("offLabel");this.host.jqxSwitchButton("offLabel",t)},t.prototype.thumbSize=function(t){if(t===undefined)return this.host.jqxSwitchButton("thumbSize");this.host.jqxSwitchButton("thumbSize",t)},t.prototype.rtl=function(t){if(t===undefined)return this.host.jqxSwitchButton("rtl");this.host.jqxSwitchButton("rtl",t)},t.prototype.width=function(t){if(t===undefined)return this.host.jqxSwitchButton("width");this.host.jqxSwitchButton("width",t)},t.prototype.check=function(){this.host.jqxSwitchButton("check")},t.prototype.disable=function(){this.host.jqxSwitchButton("disable")},t.prototype.enable=function(){this.host.jqxSwitchButton("enable")},t.prototype.toggle=function(){this.host.jqxSwitchButton("toggle")},t.prototype.uncheck=function(){this.host.jqxSwitchButton("uncheck")},t.prototype.val=function(t){return t!==undefined?this.host.jqxSwitchButton("val",t):this.host.jqxSwitchButton("val")},t.prototype.__wireEvents__=function(){var e=this;this.host.on("checked",function(t){e.onChecked.emit(t)}),this.host.on("change",function(t){e.onChange.emit(t),e.onChangeCallback(e.host.val())}),this.host.on("unchecked",function(t){e.onUnchecked.emit(t)})},t.decorators=[{type:e.Component,args:[{selector:"jqxSwitchButton",template:"<div><ng-content></ng-content></div>",providers:[o],changeDetection:e.ChangeDetectionStrategy.OnPush}]}],t.ctorParameters=function(){return[{type:e.ElementRef}]},t.propDecorators={attrChecked:[{type:e.Input,args:["checked"]}],attrDisabled:[{type:e.Input,args:["disabled"]}],attrOrientation:[{type:e.Input,args:["orientation"]}],attrOnLabel:[{type:e.Input,args:["onLabel"]}],attrOffLabel:[{type:e.Input,args:["offLabel"]}],attrThumbSize:[{type:e.Input,args:["thumbSize"]}],attrRtl:[{type:e.Input,args:["rtl"]}],attrWidth:[{type:e.Input,args:["width"]}],attrHeight:[{type:e.Input,args:["height"]}],autoCreate:[{type:e.Input,args:["auto-create"]}],onChecked:[{type:e.Output}],onChange:[{type:e.Output}],onUnchecked:[{type:e.Output}]},t}(),r=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{imports:[n.FormsModule],declarations:[h],exports:[h]}]}],t}();t.jqxSwitchButtonComponent=h,t.jqxSwitchButtonModule=r,Object.defineProperty(t,"__esModule",{value:!0})});