Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/js/yandex.market/ui/userfield/catalogcategory/ |
Upload File : |
this.BX=this.BX||{},this.BX.YandexMarket=this.BX.YandexMarket||{},this.BX.YandexMarket.Ui=this.BX.YandexMarket.Ui||{},function(t){"use strict";const e=window.YMarketJQuery||window.jQuery,n=window.BX;class s{constructor(t,e={}){this._controls={},this.onExpand=t=>{const e=t.currentTarget,n=e.closest(this.options.rowElement),s=!e.classList.contains("is--active");this.toggleRows(n,s),this.toggleExpand(e,s)},this.onChange=t=>{const e=t.currentTarget,n=this.bootControl(e);this.passParent(e,this.fulfillParentValue(e,n.value()))},this.toggleRows=(t,e)=>{let n=t;for(;n=n.nextElementSibling;){if(n.dataset.parent!==t.dataset.id)continue;if(!n.hidden!==e)if(n.hidden=!e,e)this.bootControl(n);else{const t=n.querySelector(this.options.expandElement);if(null==t||!t.classList.contains("is--active"))continue;this.toggleRows(n,!1),this.toggleExpand(t,!1)}}},this.el=t,this.options=Object.assign({},this.constructor.defaults,e),this.handleExpand(),this.bootRows()}handleExpand(){for(const t of this.el.querySelectorAll(this.options.expandElement))t.addEventListener("click",this.onExpand)}handleChange(t){e(t).on("change",this.onChange)}bootRows(){for(const t of this.el.querySelectorAll(this.options.rowElement))t.hidden||this.bootControl(t)}bootControl(t){const e=+t.dataset.id;if(null!=this._controls[e])return this._controls[e];const s=t.querySelector(this.options.controlElement);return this._controls[e]=new n.YandexMarket.Admin.Property.CategoryPanel(s,{transport:this.options.transport,form:Object.assign({},this.options.form,{parentValue:()=>{const e=this.getParent(t);return null==e?null:this.fulfillParentValue(e,this.bootControl(e).value())}}),locale:this.options.locale,language:this.options.language,parametersPool:this._parametersPool}),null==this._parametersPool&&(this._parametersPool=this._controls[e].parametersPool),this.hasChildren(t)&&this.handleChange(t),this._controls[e]}hasChildren(t){let e=t.nextElementSibling;for(;null!=e;){if(e.dataset.parent===t.dataset.id)return!0;if(null!=e.dataset.parent)break;e=e.nextElementSibling}return!1}getParent(t){if(null==t.dataset.parent)return null;let e=t.previousElementSibling;for(;null!=e;){if(e.dataset.id===t.dataset.parent)return e;e=e.previousElementSibling}return null}getChildren(t){const e=[];let n=t.nextElementSibling;for(;null!=n;)n.dataset.parent===t.dataset.id&&e.push(n),n=n.nextElementSibling;return e}passParent(t,e){for(const n of this.getChildren(t)){const t=this.bootControl(n);t.resetParent(e);const s=t.value();s.category||this.passParent(n,this.mergeParentValue(s,e))}}fulfillParentValue(t,e){if(e.category)return e;const n=this.getParent(t);if(null==n)return e;const s=this.bootControl(n).value(),o=this.mergeParentValue(e,s);return o.category?o:this.fulfillParentValue(n,o)}mergeParentValue(t,e){if(t.category)return t;const n=Object.assign({},e.parameters,t.parameters);for(const[t,e]of Object.entries(n))null!=e&&""!==e||delete n[t];return{category:e.category,parameters:n}}toggleExpand(t,e){if(t.classList.contains("is--active")===e)return;const n=t.dataset.alt,s=t.querySelector("span")||t,o=s.textContent;t.classList.toggle("is--active",e),s.textContent=n,t.dataset.alt=o}}s.defaults={rowElement:".ym-section-category__row",expandElement:".ym-section-category__expand",controlElement:".ym-category-panel",form:{},transport:{},locale:{},language:"ru"},t.CatalogCategory=s}(this.BX.YandexMarket.Ui.UserField=this.BX.YandexMarket.Ui.UserField||{}); //# sourceMappingURL=script.js.map