Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/landing/ |
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/landing/card.min.js |
(function(){"use strict";BX.namespace("BX.Landing");var n=BX.Landing.Utils.clone;var e=BX.Landing.Utils.isPlainObject;var t=BX.Landing.Utils.isEmpty;var i=BX.Landing.Utils.data;var s=BX.Landing.Utils.deepFreeze;BX.Landing.Block.Card=function(a,r,l,d){this.node=a;this.manifest=r||{};this.selector=l;this.panels=new BX.Landing.UI.Collection.PanelCollection;this.form=null;this.node.classList.add("landing-card");this.label=d;this.preset=null;this.sortIndex=-1;if(e(this.manifest.presets)&&!t(this.manifest.presets)){var o=i(this.node,"data-card-preset");if(o){this.preset=n(this.manifest.presets[o]);this.preset.id=o;s(this.preset)}}if(!BX.type.isDomNode(this.node)){throw new Error("BX.Landing.Block.Card: 'node' is not a DOMNode.")}if(!BX.type.isPlainObject(this.manifest)){throw new Error("BX.Landing.Block.Card: 'manifest' is not an Object.")}};BX.Landing.Block.Card.init=function(n,e,t){return new BX.Landing.Block.Card(n,e,t)};BX.Landing.Block.Card.prototype={getIndex:function(){var n=parseInt(this.selector.split("@")[1]);n=BX.type.isNumber(n)?n:0;return n},getName:function(){var n=(this.manifest.name||"")+" "+(this.getIndex()+1);if(this.manifest.label){var e=this.node.querySelector('[data-selector*="'+this.manifest.label+'"]');if(e&&e.innerHTML){n=e.innerHTML}}return n},getLabel:function(){return this.label},addPanel:function(n){if(!!n&&n instanceof BX.Landing.UI.Panel.BasePanel&&!this.panels.contains(n)){this.panels.add(n);this.node.appendChild(n.layout)}},clone:function(){return new BX.Landing.Block.Card(n(this.node),n(this.manifest),this.selector,n(this.label))}}})();