File manager - Edit - /home/web/vm-3fadc827.na4u.ru/www/bitrix/modules/catalog/install/js/catalog/store-selector/dist/store-selector.bundle.min.js
Back
this.BX=this.BX||{};(function(e,t,n,i,a,r,l,o){"use strict";function s(){var e=babelHelpers.taggedTemplateLiteral(["",""]);s=function t(){return e};return e}function c(){var e=babelHelpers.taggedTemplateLiteral(["",""]);c=function t(){return e};return e}function u(){var e=babelHelpers.taggedTemplateLiteral(['<div class="ui-ctl ui-ctl-w100 ui-ctl-after-icon"></div>']);u=function t(){return e};return e}function d(){var e=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<button\n\t\t\t\t\tclass="ui-ctl-after ui-ctl-icon-search"\n\t\t\t\t\tonclick="','"\n\t\t\t\t></button>\n\t\t\t']);d=function t(){return e};return e}function h(){var e=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<a\n\t\t\t\t\thref="','"\n\t\t\t\t\ttarget="_blank"\n\t\t\t\t\tclass="ui-ctl-after ui-ctl-icon-forward"\n\t\t\t\t></button>\n\t\t\t']);h=function t(){return e};return e}function g(){var e=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<button\n\t\t\t\t\tclass="ui-ctl-after ui-ctl-icon-clear"\n\t\t\t\t\tonclick="','"\n\t\t\t\t></button>\n\t\t\t']);g=function t(){return e};return e}function p(){var e=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<input\n\t\t\t\t \ttype="hidden"\n\t\t\t\t\tname="','"\n\t\t\t\t\tvalue="','"\n\t\t\t\t>\n\t\t\t']);p=function t(){return e};return e}function I(){var e=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<input type="text"\n\t\t\t\t\tclass="ui-ctl-element ui-ctl-textbox"\n\t\t\t\t\tautocomplete="off"\n\t\t\t\t\tvalue="','"\n\t\t\t\t\tplaceholder="','"\n\t\t\t\t\ttitle="','"\n\t\t\t\t\tonchange="','"\n\t\t\t\t>\n\t\t\t']);I=function t(){return e};return e}function f(){var e=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-ctl ui-ctl-textbox ui-ctl-w100">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"]);f=function t(){return e};return e}var v=function(){function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"cache",new i.Cache.MemoryCache);this.id=t||i.Text.getRandom();this.selector=n.selector;if(!(this.selector instanceof r.StoreSelector)){throw new Error("Store selector instance not found.")}this.isEnabledDetailLink=n.isEnabledDetailLink;this.inputName=n.inputName||""}babelHelpers.createClass(e,[{key:"getId",value:function e(){return this.id}},{key:"toggleIcon",value:function e(t,n){if(i.Type.isDomNode(t)){i.Dom.style(t,"display",n)}}},{key:"getNameBlock",value:function e(){var t=this;return this.cache.remember("nameBlock",function(){return i.Tag.render(f(),t.getNameInput(),t.getHiddenNameInput())})}},{key:"getNameInput",value:function e(){var t=this;return this.cache.remember("nameInput",function(){return i.Tag.render(I(),i.Text.encode(t.selector.getStoreTitle()),i.Text.encode(t.getPlaceholder()),i.Text.encode(t.selector.getStoreTitle()),t.handleNameInputHiddenChange.bind(t))})}},{key:"getHiddenNameInput",value:function e(){var t=this;return this.cache.remember("hiddenNameInput",function(){return i.Tag.render(p(),i.Text.encode(t.inputName),i.Text.encode(t.selector.getStoreTitle()))})}},{key:"handleNameInputHiddenChange",value:function e(t){this.getHiddenNameInput().value=t.target.value}},{key:"getClearIcon",value:function e(){var t=this;return this.cache.remember("closeIcon",function(){return i.Tag.render(g(),t.handleClearIconClick.bind(t))})}},{key:"getArrowIcon",value:function e(){var t=this;return this.cache.remember("arrowIcon",function(){return i.Tag.render(h(),t.selector.getDetailPath())})}},{key:"getSearchIcon",value:function e(){var t=this;return this.cache.remember("searchIcon",function(){return i.Tag.render(d(),t.handleSearchIconClick.bind(t))})}},{key:"clearInputCache",value:function e(){this.cache.delete("dialog");this.cache.delete("nameBlock");this.cache.delete("nameInput");this.cache.delete("hiddenNameInput")}},{key:"clearDialogCache",value:function e(){this.cache.delete("dialog")}},{key:"layout",value:function e(){this.clearInputCache();var t=i.Tag.render(u());t.appendChild(this.getSearchIcon());this.toggleIcon(this.getSearchIcon(),"none");t.appendChild(this.getClearIcon());this.toggleIcon(this.getClearIcon(),"none");if(this.showDetailLink()&&i.Type.isStringFilled(this.selector.getStoreTitle())){this.toggleIcon(this.getArrowIcon(),"block");t.appendChild(this.getArrowIcon())}else{this.toggleIcon(this.getSearchIcon(),"block")}i.Event.bind(this.getNameInput(),"click",this.handleNameInputClick.bind(this));i.Event.bind(this.getNameInput(),"input",this.handleNameInput.bind(this));i.Event.bind(this.getNameInput(),"blur",this.handleNameInputBlur.bind(this));i.Event.bind(this.getNameInput(),"keydown",this.handleNameInputKeyDown.bind(this));t.appendChild(this.getNameBlock());return t}},{key:"handleNameInputClick",value:function e(t){this.searchInDialog(t.target.value);this.handleIconsSwitchingOnNameInput(t)}},{key:"handleNameInput",value:function e(t){this.searchInDialog(t.target.value);this.handleIconsSwitchingOnNameInput(t)}},{key:"showDetailLink",value:function e(){return this.isEnabledDetailLink}},{key:"getDialog",value:function e(){var t=this;return this.cache.remember("dialog",function(){var e={id:t.id+"_store",height:300,context:"catalog-store",targetNode:t.getNameInput(),enableSearch:false,multiple:false,dropdownMode:true,searchTabOptions:{stub:true,stubOptions:{title:i.Tag.message(c(),"CATALOG_STORE_SELECTOR_IS_EMPTY_TITLE"),subtitle:i.Tag.message(s(),"CATALOG_STORE_SELECTOR_IS_EMPTY_SUBTITLE"),arrow:true}},events:{"Item:onSelect":t.onStoreSelect.bind(t),onSearch:t.onSearch.bind(t),"Search:onItemCreateAsync":t.createStore.bind(t)},entities:[{id:"store",options:{productId:t.selector.getProductId()},searchFields:[{name:"subtitle",type:"string",system:true,searchable:false}],dynamicLoad:true,dynamicSearch:true}],searchOptions:{allowCreateItem:true}};return new a.Dialog(e)})}},{key:"handleNameInputKeyDown",value:function e(t){var n=this.getDialog();if(t.key==="Enter"&&n.getActiveTab()===n.getSearchTab()){t.preventDefault();if(i.Browser.isMac()&&t.metaKey||t.ctrlKey){n.getSearchTab().getFooter().createItem()}}}},{key:"handleIconsSwitchingOnNameInput",value:function e(t){this.toggleIcon(this.getArrowIcon(),"none");if(i.Type.isStringFilled(t.target.value)){this.toggleIcon(this.getClearIcon(),"block");this.toggleIcon(this.getSearchIcon(),"none")}else{this.toggleIcon(this.getClearIcon(),"none");this.toggleIcon(this.getSearchIcon(),"block")}}},{key:"handleClearIconClick",value:function e(t){this.selector.onClear();t.stopPropagation();t.preventDefault()}},{key:"focusName",value:function e(){var t=this;requestAnimationFrame(function(){return t.getNameInput().focus()})}},{key:"searchInDialog",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";var n=this.getDialog();if(n){n.show();n.search(t)}}},{key:"handleShowSearchDialog",value:function e(t){this.searchInDialog(t.target.value)}},{key:"handleNameInputBlur",value:function e(t){var n=this;setTimeout(function(){n.toggleIcon(n.getClearIcon(),"none");if(n.showDetailLink()&&i.Type.isStringFilled(n.selector.getStoreTitle())){n.toggleIcon(n.getSearchIcon(),"none");n.toggleIcon(n.getArrowIcon(),"block")}else{n.toggleIcon(n.getArrowIcon(),"none");n.toggleIcon(n.getSearchIcon(),"block")}},200)}},{key:"handleSearchIconClick",value:function e(t){this.searchInDialog();this.focusName();t.stopPropagation();t.preventDefault()}},{key:"onSearch",value:function e(t){var n=t.getData(),i=n.query;if(i===""||i===this.selector.getStoreTitle()){var a,r,l;(a=t.target)===null||a===void 0?void 0:(r=a.searchTab)===null||r===void 0?void 0:(l=r.getFooter())===null||l===void 0?void 0:l.hide()}else{var o,s,c;(o=t.target)===null||o===void 0?void 0:(s=o.searchTab)===null||s===void 0?void 0:(c=s.getFooter())===null||c===void 0?void 0:c.show()}}},{key:"onStoreSelect",value:function e(t){var n=t.getData().item;n.getDialog().getTargetNode().value=n.getTitle();if(this.selector){this.selector.onStoreSelect(n.getId(),n.getTitle())}this.toggleIcon(this.getSearchIcon(),"none");this.selector.clearLayout();this.selector.layout();this.cache.delete("dialog")}},{key:"createStore",value:function e(t){var n=t.getData(),a=n.searchQuery;var r=a.getQuery();return new Promise(function(e,n){if(!i.Type.isStringFilled(r)){n();return}var a=t.getTarget();a.showLoader();i.ajax.runAction("catalog.storeSelector.createStore",{json:{name:r}}).then(function(t){a.hideLoader();var n=i.Text.toInteger(t.data.id);var l=a.addItem({id:n,entityId:"store",title:r,tabs:a.getRecentTab().getId()});if(l){l.select()}a.hide();e()}).catch(function(){return n()})})}},{key:"getPlaceholder",value:function e(){return i.Loc.getMessage("CATALOG_STORE_SELECTOR_BEFORE_SEARCH_TITLE")}}]);return e}();function b(){var e=babelHelpers.taggedTemplateLiteral(['<div class="catalog-store-field-input"></div>']);b=function t(){return e};return e}function T(){var e=babelHelpers.taggedTemplateLiteral(['<span title="','">',"</span>"]);T=function t(){return e};return e}function m(){var e=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<a href="','" title="','">',"</a>\n\t\t\t"]);m=function t(){return e};return e}function y(){var e=babelHelpers.taggedTemplateLiteral(['<div class="catalog-store-field-inner"></div>']);y=function t(){return e};return e}var k=new Map;var S=new WeakMap;var E=function(e){babelHelpers.inherits(t,e);babelHelpers.createClass(t,null,[{key:"getById",value:function e(t){return k.get(t)||null}}]);function t(e){var n;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(n),"mode",t.MODE_EDIT);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(n),"productId",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(n),"cache",new i.Cache.MemoryCache);S.set(babelHelpers.assertThisInitialized(n),{writable:true,value:new Map});n.setEventNamespace("BX.Catalog.StoreSelector");n.id=e||i.Text.getRandom();a.inputFieldTitle=a.inputFieldTitle||t.INPUT_FIELD_TITLE;a.inputFieldId=a.inputFieldId||t.INPUT_FIELD_ID;n.options=a||{};n.setMode(a.mode);if(a.model instanceof o.ProductModel&&a.model.getField(a.inputFieldId)>0){babelHelpers.classPrivateFieldGet(babelHelpers.assertThisInitialized(n),S).set("id",a.model.getField(a.inputFieldId));var r=i.Type.isStringFilled(a.model.getField(a.inputFieldTitle))?a.model.getField(a.inputFieldTitle):"";n.setProductId(a.model.getSkuId());babelHelpers.classPrivateFieldGet(babelHelpers.assertThisInitialized(n),S).set("title",r)}else{var l=i.Extension.getSettings("catalog.store-selector");babelHelpers.classPrivateFieldGet(babelHelpers.assertThisInitialized(n),S).set("id",l.get("defaultStoreId"));babelHelpers.classPrivateFieldGet(babelHelpers.assertThisInitialized(n),S).set("title",l.get("defaultStoreName"))}n.searchInput=new v(n.id,{selector:babelHelpers.assertThisInitialized(n),inputName:n.options.inputFieldTitle});n.layout();k.set(n.id,babelHelpers.assertThisInitialized(n));return n}babelHelpers.createClass(t,[{key:"setMode",value:function e(n){if(!i.Type.isNil(n)){this.mode=n===t.MODE_VIEW?t.MODE_VIEW:t.MODE_EDIT}}},{key:"setProductId",value:function e(t){var n;t=i.Text.toNumber(t);if(t>0){this.productId=t}else{this.productId=null}(n=this.searchInput)===null||n===void 0?void 0:n.clearDialogCache()}},{key:"isViewMode",value:function e(){return this.mode===t.MODE_VIEW}},{key:"isSaveable",value:function e(){return!this.isViewMode()&&this.isSaveable()}},{key:"getId",value:function e(){return this.id}},{key:"getProductId",value:function e(){return this.productId}},{key:"getConfig",value:function e(t,n){return BX.prop.get(this.options.config,t,n)}},{key:"getDetailPath",value:function e(){return this.getConfig("detailPath","")}},{key:"getWrapper",value:function e(){if(!this.wrapper){this.wrapper=document.getElementById(this.id)}return this.wrapper}},{key:"renderTo",value:function e(t){this.clearLayout();this.wrapper=t;this.layout()}},{key:"layout",value:function e(){var t=this.getWrapper();if(!t){return}this.defineWrapperClass(t);var n=i.Tag.render(y());t.appendChild(n);n.appendChild(this.layoutNameBlock())}},{key:"focusName",value:function e(){if(this.searchInput){this.searchInput.focusName()}return this}},{key:"onClear",value:function e(){this.clearState();this.clearLayout();this.layout();this.searchInput.searchInDialog();this.focusName();this.emit("onClear",{selectorId:this.getId(),rowId:this.getRowId()})}},{key:"clearState",value:function e(){babelHelpers.classPrivateFieldGet(this,S).clear()}},{key:"clearLayout",value:function e(){var t=this.getWrapper();if(t){t.innerHTML=""}}},{key:"unsubscribeEvents",value:function e(){}},{key:"defineWrapperClass",value:function e(t){if(this.isViewMode()){i.Dom.addClass(t,"catalog-store-view");i.Dom.removeClass(t,"catalog-store-edit")}else{i.Dom.addClass(t,"catalog-store-edit");i.Dom.removeClass(t,"catalog-store-view")}}},{key:"getViewHtml",value:function e(){var t=i.Text.encode(this.getStoreTitle());var n=i.Loc.getMessage("CATALOG_STORE_SELECTOR_VIEW_NAME_TITLE");if(this.getDetailPath()){return i.Tag.render(m(),this.getDetailPath(),n,t)}return i.Tag.render(T(),n,t)}},{key:"layoutNameBlock",value:function e(){var t=i.Tag.render(b());if(this.isViewMode()){t.appendChild(this.getViewHtml())}else{t.appendChild(this.searchInput.layout())}return t}},{key:"getStoreTitle",value:function e(){return babelHelpers.classPrivateFieldGet(this,S).get("title")||""}},{key:"getStoreId",value:function e(){return babelHelpers.classPrivateFieldGet(this,S).get("id")||""}},{key:"onStoreSelect",value:function e(t,n){if(n===""){n=i.Loc.getMessage("CATALOG_STORE_SELECTOR_EMPTY_STORE_TITLE")}babelHelpers.classPrivateFieldGet(this,S).set("id",t);babelHelpers.classPrivateFieldGet(this,S).set("title",n);this.clearLayout();this.layout();this.emit("onChange",{selectorId:this.id,rowId:this.getRowId(),fields:[{NAME:this.options.inputFieldId,VALUE:t},{NAME:this.options.inputFieldTitle,VALUE:n}]})}},{key:"getRowId",value:function e(){return this.getConfig("ROW_ID")}}]);return t}(n.EventEmitter);babelHelpers.defineProperty(E,"MODE_VIEW","view");babelHelpers.defineProperty(E,"MODE_EDIT","edit");babelHelpers.defineProperty(E,"INPUT_FIELD_TITLE","STORE_TITLE");babelHelpers.defineProperty(E,"INPUT_FIELD_ID","STORE_ID");e.StoreSelector=E})(this.BX.Catalog=this.BX.Catalog||{},BX,BX.Event,BX,BX.UI.EntitySelector,BX.Catalog,BX,BX.Catalog); //# sourceMappingURL=store-selector.bundle.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.26 |
proxy
|
phpinfo
|
Settings