Your IP : 172.70.178.32


Current Path : /var/www/element/data/www/revenuestory.ru/bitrix/js/ui/counterpanel/dist/
Upload File :
Current File : /var/www/element/data/www/revenuestory.ru/bitrix/js/ui/counterpanel/dist/counterpanel.bundle.min.js

this.BX=this.BX||{};(function(t,e,i,n,a){"use strict";var s,r,l,o,u,c,h;function v(t,e){d(t,e);e.add(t)}function d(t,e){if(e.has(t)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function p(t,e,i){if(!e.has(t)){throw new TypeError("attempted to get private field on non-instance")}return i}var f=new WeakSet;var m=new WeakSet;var y=new WeakSet;var g=new WeakSet;var k=new WeakSet;var C=new WeakSet;var T=function(){function t(e){babelHelpers.classCallCheck(this,t);v(this,C);v(this,k);v(this,g);v(this,y);v(this,m);v(this,f);this.id=e.id?e.id:null;this.separator=i.Type.isBoolean(e.separator)?e.separator:true;this.items=i.Type.isArray(e.items)?e.items:[];this.popupMenu=null;this.isActive=i.Type.isBoolean(e.isActive)?e.isActive:false;this.panel=e.panel?e.panel:null;this.title=e.title?e.title:null;this.value=i.Type.isNumber(e.value)&&e.value!==undefined?e.value:null;this.titleOrder=null;this.valueOrder=null;this.color=e.color?e.color:null;this.parent=i.Type.isBoolean(e.parent)?e.parent:null;this.parentId=e.parentId?e.parentId:null;this.locked=false;this.type=i.Type.isString(e.type)?e.type.toLowerCase():null;this.eventsForActive=i.Type.isObject(e.eventsForActive)?e.eventsForActive:{};this.eventsForUnActive=i.Type.isObject(e.eventsForUnActive)?e.eventsForUnActive:{};if(i.Type.isObject(e.title)){this.title=e.title.value?e.title.value:null;this.titleOrder=i.Type.isNumber(e.title.order)?e.title.order:null}if(i.Type.isObject(e.value)){this.value=i.Type.isNumber(e.value.value)?e.value.value:null;this.valueOrder=i.Type.isNumber(e.value.order)?e.value.order:null}this.layout={container:null,value:null,title:null,cross:null,dropdownArrow:null,menuItem:null};this.counter=p(this,y,A).call(this);if(!p(this,m,w).call(this).isMultiselect()){p(this,f,b).call(this)}}babelHelpers.createClass(t,[{key:"getItems",value:function t(){return this.items}},{key:"hasParentId",value:function t(){return this.parentId}},{key:"updateValue",value:function t(e){if(i.Type.isNumber(e)){this.value=e;p(this,y,A).call(this).update(e);if(e===0){this.updateColor(this.parentId?"GRAY":"THEME")}}}},{key:"updateValueAnimate",value:function t(e){if(i.Type.isNumber(e)){this.value=e;p(this,y,A).call(this).update(e);p(this,y,A).call(this).show();if(e===0){this.updateColor(this.parentId?"GRAY":"THEME")}}}},{key:"updateColor",value:function t(e){if(i.Type.isString(e)){this.color=e;p(this,y,A).call(this).setColor(n.Counter.Color[e])}}},{key:"activate",value:function t(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.isActive=true;if(this.parentId){var i=BX.findParent(this.getContainerMenu(),{className:"ui-counter-panel__popup-item"});if(i){i.classList.add("--active")}}else{this.getContainer().classList.add("--active")}if(e){a.EventEmitter.emit("BX.UI.CounterPanel.Item:activate",this)}}},{key:"deactivate",value:function t(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.isActive=false;if(this.parentId){var i=BX.findParent(this.getContainerMenu(),{className:"ui-counter-panel__popup-item"});if(i){i.classList.remove("--active");i.classList.remove("--hover")}}else{this.getContainer().classList.remove("--active");this.getContainer().classList.remove("--hover")}if(e){a.EventEmitter.emit("BX.UI.CounterPanel.Item:deactivate",this)}}},{key:"getSeparator",value:function t(){return this.separator}},{key:"setEvents",value:function t(e){var i=this;if(!e){e=this.getContainer()}if(this.eventsForActive){var n=Object.keys(this.eventsForActive);var a=function t(a){var s=n[a];e.addEventListener(s,(function(){if(i.isActive){i.eventsForActive[s]()}}))};for(var s=0;s<n.length;s++){a(s)}}if(this.eventsForUnActive){var r=Object.keys(this.eventsForUnActive);var l=function t(n){var a=r[n];e.addEventListener(a,(function(){if(!i.isActive){i.eventsForUnActive[a]()}}))};for(var o=0;o<r.length;o++){l(o)}}}},{key:"isLocked",value:function t(){return this.locked}},{key:"lock",value:function t(){this.locked=true;this.getContainer().classList.add("--locked")}},{key:"unLock",value:function t(){this.locked=false;this.getContainer().classList.remove("--locked")}},{key:"getArrowDropdown",value:function t(){if(!this.layout.dropdownArrow){this.layout.dropdownArrow=i.Tag.render(s||(s=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-counter-panel__item-dropdown">\n\t\t\t\t\t<i></i>\n\t\t\t\t</div>\n\t\t\t'])))}return this.layout.dropdownArrow}},{key:"getContainerMenu",value:function t(){if(!this.layout.menuItem){this.layout.menuItem=i.Tag.render(r||(r=babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t<span>\n\t\t\t\t\t","\n\t\t\t\t\t","\n\t\t\t\t\t","\n\t\t\t\t</span>\n\t\t\t"])),p(this,g,L).call(this),this.title,p(this,C,E).call(this))}return this.layout.menuItem}},{key:"getContainer",value:function t(){var e=this;if(!this.layout.container){var n=this.type?'id="ui-counter-panel-item-'.concat(this.type,'"'):"";var a=i.Type.isNumber(this.value);this.layout.container=i.Tag.render(l||(l=babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t<div ",' class="ui-counter-panel__item">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),n,a?p(this,g,L).call(this):"",this.title?p(this,k,I).call(this):"",a?p(this,C,E).call(this):"");if(this.parent){this.layout.container=i.Tag.render(o||(o=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t<div class="ui-counter-panel__item">\n\t\t\t\t\t\t',"\n\t\t\t\t\t\t","\n\t\t\t\t\t\t","\n\t\t\t\t\t</div>\n\t\t\t\t"])),this.title?p(this,k,I).call(this):"",a?p(this,g,L).call(this):"",p(this,C,E).call(this));p(this,C,E).call(this).addEventListener("click",(function(t){e.deactivate();t.stopPropagation()}));i.Dom.addClass(this.layout.container,"--dropdown")}if(!a){this.layout.container.classList.add("--string")}if(!a&&!this.eventsForActive&&!this.eventsForUnActive){this.layout.container.classList.add("--title")}if(!this.separator){this.layout.container.classList.add("--without-separator")}if(this.locked){this.layout.container.classList.add("--locked")}if(this.isActive){this.activate()}this.setEvents(this.layout.container);if(a&&this.items.length===0){if(!this.parent){this.layout.container.addEventListener("mouseenter",(function(){if(!e.isActive){e.layout.container.classList.add("--hover")}}));this.layout.container.addEventListener("mouseleave",(function(){if(!e.isActive){e.layout.container.classList.remove("--hover")}}));this.layout.container.addEventListener("click",(function(){e.isActive?e.deactivate():e.activate()}))}}if(this.parent){i.Dom.append(this.getArrowDropdown(),this.layout.container)}}return this.layout.container}}]);return t}();function b(){var t=this;a.EventEmitter.subscribe("BX.UI.CounterPanel.Item:activate",(function(e){var i=e.data.parentId===t.id;if(e.data!==t&&!i){t.deactivate()}}))}function w(){return this.panel}function A(t,e){if(!this.counter){this.counter=new n.Counter({value:this.value,color:this.color?n.Counter.Color[this.color.toUpperCase()]:this.parentId?n.Counter.Color.GRAY:n.Counter.Color.THEME,animation:false})}return this.counter}function L(){if(!this.layout.value){this.layout.value=i.Tag.render(u||(u=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-counter-panel__item-value">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t"])),p(this,y,A).call(this).getContainer());this.layout.value.style.setProperty("order",this.valueOrder)}return this.layout.value}function I(){if(!this.layout.title){this.layout.title=i.Tag.render(c||(c=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-counter-panel__item-title">',"</div>\n\t\t\t"])),this.title);this.layout.title.style.setProperty("order",this.titleOrder)}return this.layout.title}function E(){if(!this.layout.cross){this.layout.cross=i.Tag.render(h||(h=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-counter-panel__item-cross">\n\t\t\t\t\t<i></i>\n\t\t\t\t</div>\n\t\t\t'])))}return this.layout.cross}var _,B,H;function P(t,e){F(t,e);e.add(t)}function F(t,e){if(e.has(t)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function O(t,e,i){if(!e.has(t)){throw new TypeError("attempted to get private field on non-instance")}return i}var S=new WeakSet;var U=new WeakSet;var X=new WeakSet;var M=function(){function t(e){babelHelpers.classCallCheck(this,t);P(this,X);P(this,U);P(this,S);this.target=i.Type.isDomNode(e.target)?e.target:null;this.items=i.Type.isArray(e.items)?e.items:[];this.multiselect=i.Type.isBoolean(e.multiselect)?e.multiselect:null;this.title=i.Type.isStringFilled(e.title)?e.title:null;this.container=null;this.keys=[];this.hasParent=[];this.childKeys=[]}babelHelpers.createClass(t,[{key:"isMultiselect",value:function t(){return this.multiselect}},{key:"getItems",value:function t(){return this.items}},{key:"getItemById",value:function t(e){if(e){var i=this.keys.indexOf(e);return this.items[i]}}},{key:"init",value:function t(){O(this,S,N).call(this);O(this,X,j).call(this)}}]);return t}();function N(){var t=this;this.items=this.items.map((function(e){e.panel=t;t.keys.push(e.id);if(e.parentId){t.hasParent.push(e.parentId)}return new T(e)}));this.hasParent.forEach((function(e){var i=t.keys.indexOf(e);t.items[i].parent=true}));this.items.map((function(e){if(e.parentId){var i=t.keys.indexOf(e.parentId);t.items[i].items.push(e.id)}}))}function W(){if(!this.container){var t="";if(this.title){t=i.Tag.render(_||(_=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t<div class="ui-counter-panel__item-head">',"</div>\n\t\t\t\t"])),this.title)}this.container=i.Tag.render(B||(B=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-counter-panel ui-counter-panel__scope">',"</div>\n\t\t\t"])),t)}return this.container}function j(){var t=this;if(this.target&&this.items.length>0){this.items.map((function(n,a){if(n instanceof T){if(!n.hasParentId()){O(t,U,W).call(t).appendChild(n.getContainer());if(t.items.length!==a+1&&t.items.length>1){O(t,U,W).call(t).appendChild(i.Tag.render(H||(H=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t<div class="ui-counter-panel__item-separator ','"></div>\n\t\t\t\t\t\t\t'])),!n.getSeparator()?"--invisible":""))}}if(n.parent){n.getContainer().addEventListener("click",(function(){var i=[];n.getItems().forEach((function(e){var n=t.getItemById(e);var a={html:n.getContainerMenu(),className:"ui-counter-panel__popup-item menu-popup-no-icon ".concat(n.isActive?"--active":""),onclick:function t(){n.isActive?n.deactivate():n.activate()}};i.push(a)}));var a=new e.PopupMenuWindow({className:"ui-counter-panel__popup ui-counter-panel__scope",bindElement:n.getArrowDropdown(),autoHide:true,closeByEsc:true,items:i,angle:true,offsetLeft:6,offsetTop:-7,animation:"fading-slide",events:{onPopupShow:function t(){n.getContainer().classList.add("--hover");n.getContainer().classList.add("--pointer-events-none")},onPopupClose:function t(){n.getContainer().classList.remove("--hover");n.getContainer().classList.remove("--pointer-events-none");a.destroy()}}});a.show()}))}}}));i.Dom.clean(this.target);this.target.appendChild(O(this,U,W).call(this))}}t.CounterPanel=M;t.CounterItem=T})(this.BX.UI=this.BX.UI||{},BX.Main,BX,BX.UI,BX.Event);
//# sourceMappingURL=counterpanel.bundle.map.js