Your IP : 3.143.24.92


Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/switcher/dist/
Upload File :
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/switcher/dist/ui.switcher.bundle.min.js

this.BX=this.BX||{};(function(e,s){"use strict";let i=e=>e,t,a;const l=Object.freeze({medium:"medium",small:"small",extraSmall:"extra-small"});const r=Object.freeze({primary:"primary",green:"green"});var o=babelHelpers.classPrivateFieldLooseKey("classNameSize");var c=babelHelpers.classPrivateFieldLooseKey("classNameColor");var d=babelHelpers.classPrivateFieldLooseKey("disabled");var n=babelHelpers.classPrivateFieldLooseKey("inputName");var h=babelHelpers.classPrivateFieldLooseKey("loading");var b=babelHelpers.classPrivateFieldLooseKey("classNameOff");var p=babelHelpers.classPrivateFieldLooseKey("classNameLock");var u=babelHelpers.classPrivateFieldLooseKey("attributeName");var v=babelHelpers.classPrivateFieldLooseKey("attributeInitName");var m=babelHelpers.classPrivateFieldLooseKey("initNode");var P=babelHelpers.classPrivateFieldLooseKey("fireEvent");class L{constructor(e){Object.defineProperty(this,P,{value:H});Object.defineProperty(this,m,{value:f});Object.defineProperty(this,o,{writable:true,value:{[l.extraSmall]:"ui-switcher-size-xs",[l.small]:"ui-switcher-size-sm",[l.medium]:""}});Object.defineProperty(this,c,{writable:true,value:{[r.primary]:"",[r.green]:"ui-switcher-color-green"}});this.node=null;this.checked=false;this.id="";Object.defineProperty(this,d,{writable:true,value:false});Object.defineProperty(this,n,{writable:true,value:""});Object.defineProperty(this,h,{writable:true,value:void 0});Object.defineProperty(this,b,{writable:true,value:"ui-switcher-off"});Object.defineProperty(this,p,{writable:true,value:"ui-switcher-lock"});Object.defineProperty(this,u,{writable:true,value:"data-switcher"});this.init(e);L.list.push(this)}static getById(e){return L.list.find((s=>s.id===e))||null}static initByClassName(){const e=document.getElementsByClassName(L.className);Array.from(e).forEach((function(e){if(e.getAttribute(babelHelpers.classPrivateFieldLooseBase(L,v)[v])){return}new L({node:e})}))}static getList(){return L.list}init(e={}){babelHelpers.classPrivateFieldLooseBase(this,u)[u]=s.Type.isString(e.attributeName)?e.attributeName:babelHelpers.classPrivateFieldLooseBase(this,u)[u];this.handlers=s.Type.isPlainObject(e.handlers)?e.handlers:{};babelHelpers.classPrivateFieldLooseBase(this,n)[n]=s.Type.isString(e.inputName)?e.inputName:"";babelHelpers.classPrivateFieldLooseBase(this,h)[h]=false;this.events={toggled:"toggled",checked:"checked",unchecked:"unchecked",lock:"lock",unlock:"unlock"};if(e.node){if(!s.Type.isDomNode(e.node)){throw new Error("Parameter `node` DOM Node expected.")}this.node=e.node;let i=this.node.getAttribute(babelHelpers.classPrivateFieldLooseBase(this,u)[u]);try{i=JSON.parse(i)||{}}catch(e){i={}}if(i.id){this.id=i.id}this.checked=Boolean(i.checked);babelHelpers.classPrivateFieldLooseBase(this,n)[n]=i.inputName;if(s.Type.isString(i.color)&&Object.values(r).includes(i.color)){e.color=i.color}if(s.Type.isString(i.size)&&Object.values(l).includes(i.size)){e.size=i.size}}else{this.node=document.createElement("span")}if(babelHelpers.classPrivateFieldLooseBase(this,o)[o][e.size]){s.Dom.addClass(this.node,babelHelpers.classPrivateFieldLooseBase(this,o)[o][e.size])}if(babelHelpers.classPrivateFieldLooseBase(this,c)[c][e.color]){s.Dom.addClass(this.node,babelHelpers.classPrivateFieldLooseBase(this,c)[c][e.color])}if(s.Type.isString(e.id)||s.Type.isNumber(e.id)){this.id=e.id}else if(!this.id){this.id=Math.random()}if(s.Type.isString(e.inputName)){babelHelpers.classPrivateFieldLooseBase(this,n)[n]=e.inputName}this.checked=s.Type.isBoolean(e.checked)?e.checked:this.checked;babelHelpers.classPrivateFieldLooseBase(this,d)[d]=s.Type.isBoolean(e.disabled)?e.disabled:babelHelpers.classPrivateFieldLooseBase(this,d)[d];babelHelpers.classPrivateFieldLooseBase(this,m)[m]();this.check(this.checked,false);this.disable(babelHelpers.classPrivateFieldLooseBase(this,d)[d],false)}disable(e,i){if(this.isLoading()){return}babelHelpers.classPrivateFieldLooseBase(this,d)[d]=e;i=i!==false;if(e){s.Dom.addClass(this.node,babelHelpers.classPrivateFieldLooseBase(this,p)[p]);i?babelHelpers.classPrivateFieldLooseBase(this,P)[P](this.events.lock):null}else{s.Dom.removeClass(this.node,babelHelpers.classPrivateFieldLooseBase(this,p)[p]);i?babelHelpers.classPrivateFieldLooseBase(this,P)[P](this.events.unlock):null}}check(e,i){if(this.isLoading()){return}this.checked=!!e;if(this.inputNode){this.inputNode.value=this.checked?"Y":"N"}i=i!==false;if(this.checked){s.Dom.removeClass(this.node,babelHelpers.classPrivateFieldLooseBase(this,b)[b]);i?babelHelpers.classPrivateFieldLooseBase(this,P)[P](this.events.unchecked):null}else{s.Dom.addClass(this.node,babelHelpers.classPrivateFieldLooseBase(this,b)[b]);i?babelHelpers.classPrivateFieldLooseBase(this,P)[P](this.events.checked):null}if(i){babelHelpers.classPrivateFieldLooseBase(this,P)[P](this.events.toggled)}}isDisabled(){return babelHelpers.classPrivateFieldLooseBase(this,d)[d]}isChecked(){return this.checked}toggle(){if(this.isDisabled()){return}this.check(!this.isChecked())}setLoading(e){babelHelpers.classPrivateFieldLooseBase(this,h)[h]=Boolean(e);const a=this.getNode().querySelector(".ui-switcher-cursor");if(babelHelpers.classPrivateFieldLooseBase(this,h)[h]){const e=s.Tag.render(t||(t=i`
				<svg viewBox="25 25 50 50">
					<circle
						class="ui-sidepanel-wrapper-loader-path"
						cx="50"
						cy="50"
						r="19"
						fill="none"
						stroke-width="5"
						stroke-miterlimit="10"
					>
					</circle>
				</svg>
			`));s.Dom.append(e,a)}else{a.innerHTML=""}}isLoading(){return babelHelpers.classPrivateFieldLooseBase(this,h)[h]}renderTo(e){if(!s.Type.isDomNode(e)){throw new Error("Target node must be HTMLElement")}return s.Dom.append(this.getNode(),e)}getNode(){return this.node}getAttributeName(){return babelHelpers.classPrivateFieldLooseBase(this,u)[u]}getInputName(){return babelHelpers.classPrivateFieldLooseBase(this,n)[n]}}function f(){if(this.node.getAttribute(babelHelpers.classPrivateFieldLooseBase(L,v)[v])){return}this.node.setAttribute(babelHelpers.classPrivateFieldLooseBase(L,v)[v],"y");s.Dom.addClass(this.node,L.className);this.node.innerHTML='<span class="ui-switcher-cursor"></span>\n'+'<span class="ui-switcher-enabled">'+s.Loc.getMessage("UI_SWITCHER_ON")+"</span>\n"+'<span class="ui-switcher-disabled">'+s.Loc.getMessage("UI_SWITCHER_OFF")+"</span>\n";if(babelHelpers.classPrivateFieldLooseBase(this,n)[n]){this.inputNode=s.Tag.render(a||(a=i`
				<input type="hidden" name="${0}" />
			`),babelHelpers.classPrivateFieldLooseBase(this,n)[n]);s.Dom.append(this.inputNode,this.node)}s.bind(this.node,"click",this.toggle.bind(this))}function H(e){s.onCustomEvent(this,e);if(this.handlers[e]){this.handlers[e].call(this)}}Object.defineProperty(L,v,{writable:true,value:"data-switcher-init"});L.list=[];L.className="ui-switcher";e.SwitcherSize=l;e.SwitcherColor=r;e.Switcher=L})(this.BX.UI=this.BX.UI||{},BX);
//# sourceMappingURL=ui.switcher.bundle.map.js