Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/ui/collapser/dist/ |
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/ui/collapser/dist/bundle.min.js |
this.BX=this.BX||{};(function(e,t,i){"use strict";function n(e,t){s(e,t);t.add(e)}function a(e,t,i){s(e,t);t.set(e,i)}function s(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function r(e,t,i){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return i}var l=new WeakMap;var o=new WeakMap;var u=new WeakMap;var h=new WeakMap;var v=new WeakMap;var c=new WeakMap;var p=new WeakSet;var d=function(){function e(i){babelHelpers.classCallCheck(this,e);n(this,p);a(this,l,{writable:true,value:void 0});a(this,o,{writable:true,value:void 0});a(this,u,{writable:true,value:void 0});a(this,h,{writable:true,value:void 0});a(this,v,{writable:true,value:void 0});a(this,c,{writable:true,value:void 0});babelHelpers.classPrivateFieldSet(this,l,t.Type.isNil(i.id)?"collapser_"+t.Text.getRandom(8):i.id);babelHelpers.classPrivateFieldSet(this,o,t.Type.isBoolean(i.isOpen)?i.isOpen:true);babelHelpers.classPrivateFieldSet(this,u,i.outerContainer);babelHelpers.classPrivateFieldSet(this,h,i.innerContainer);babelHelpers.classPrivateFieldSet(this,v,t.Type.isNumber(i.duration)?i.duration:500);babelHelpers.classPrivateFieldSet(this,c,t.Type.isFunction(i.calcProgress)?i.calcProgress:r(this,p,b));this.init(i)}babelHelpers.createClass(e,[{key:"init",value:function e(i){t.Dom.style(this.getChildrenContainer(),"overflow","hidden");if(!babelHelpers.classPrivateFieldGet(this,o)){t.Dom.style(this.getChildrenContainer(),"height","0px")}if(t.Type.isElementNode(i.buttons)){i.buttons=[i.buttons]}if(t.Type.isArray(i.buttons)||i.buttons instanceof NodeList){for(var n in i.buttons){var a=i.buttons[n];if(t.Type.isElementNode(a)){a.addEventListener("click",this.toggle.bind(this))}}}else{this.getOuterContainer().addEventListener("click",this.toggle.bind(this))}}},{key:"expand",value:function e(){if(this.isOpen()){return}this.showAnimate(true)}},{key:"collapse",value:function e(){if(!this.isOpen()){return}this.showAnimate(false)}},{key:"showAnimate",value:function e(n){var a=this;var s=performance.now();var r=this.makeDraw(this.isOpen());var l=function e(l){var o=(l-s)/babelHelpers.classPrivateFieldGet(a,v);if(o>1){o=1}var u=babelHelpers.classPrivateFieldGet(a,c).call(a,o);r(u);if(o<1){requestAnimationFrame(e)}else{a.setOpen(n);i.EventEmitter.emit(i.EventEmitter.GLOBAL_TARGET,"BX.UI.Collapse:onToggle",{isOpen:a.isOpen(),source:a});if(n){t.Dom.style(a.getChildrenContainer(),"height",null)}}};requestAnimationFrame(l)}},{key:"makeDraw",value:function e(i){var n=this;if(i){return function(e){var i=n.getChildrenContainer().offsetHeight-n.getChildrenContainer().offsetHeight*e;t.Dom.style(n.getChildrenContainer(),"height",i+"px")}}else{return function(e){var i=n.getChildrenContainer().scrollHeight*e;t.Dom.style(n.getChildrenContainer(),"height",i+"px")}}}},{key:"getChildrenContainer",value:function e(){return babelHelpers.classPrivateFieldGet(this,h)}},{key:"getOuterContainer",value:function e(){return babelHelpers.classPrivateFieldGet(this,u)}},{key:"setOpen",value:function e(t){babelHelpers.classPrivateFieldSet(this,o,t)}},{key:"isOpen",value:function e(){return babelHelpers.classPrivateFieldGet(this,o)}},{key:"toggle",value:function e(){this.isOpen()?this.collapse():this.expand()}},{key:"getId",value:function e(){return babelHelpers.classPrivateFieldGet(this,l)}}]);return e}();function b(e){return e}e.Collapser=d})(this.BX.UI=this.BX.UI||{},BX,BX.Event); //# sourceMappingURL=bundle.map.js