File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/modules/catalog/install/js/catalog/store-selector/dist/store-selector.bundle.min.js
Back
this.BX=this.BX||{};(function(e,t,i,a,l,r,n,s){"use strict";var o=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(o,"NOT_SELECTED_STORE","NOT_SELECTED_STORE");var c,u,d,h,g,p,b,I,v,f;var m=function(){function e(t){var i,l;var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"cache",new a.Cache.MemoryCache);this.id=t||a.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||"";this.allowCreateItem=n.allowCreateItem!==undefined?n.allowCreateItem:true;this.disableByRights=(i=n.disableByRights)!==null&&i!==void 0?i:false;this.disabledHint=(l=n.disabledHint)!==null&&l!==void 0?l:a.Loc.getMessage("CATALOG_STORE_SELECTOR_HAS_PERMISSION_VIEW_STORES_HINT")}babelHelpers.createClass(e,[{key:"getId",value:function e(){return this.id}},{key:"toggleIcon",value:function e(t,i){if(a.Type.isDomNode(t)){a.Dom.style(t,"display",i)}}},{key:"getNameBlock",value:function e(){var t=this;if(this.disableByRights){return a.Tag.render(c||(c=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div\n\t\t\t\t\tclass="ui-ctl ui-ctl-w100 ui-ctl-before-icon ui-ctl-after-icon ui-ctl-disabled"\n\t\t\t\t\tdata-hint="','"\n\t\t\t\t\tdata-hint-no-icon\n\t\t\t\t>\n\t\t\t\t\t<div class="ui-ctl-before catalog-store-field-input-access-denied-lock"></div>\n\t\t\t\t\t<div class="ui-ctl-after catalog-store-field-input-access-denied-hint"></div>\n\t\t\t\t\t<div class="ui-ctl-element">',"</div>\n\t\t\t\t</div>\n\t\t\t"])),this.disabledHint,a.Loc.getMessage("CATALOG_STORE_SELECTOR_HAS_PERMISSION_VIEW_STORES_TITLE"))}return this.cache.remember("nameBlock",(function(){return a.Tag.render(u||(u=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"])),t.getNameInput(),t.getHiddenNameInput())}))}},{key:"getNameInput",value:function e(){var t=this;return this.cache.remember("nameInput",(function(){return a.Tag.render(d||(d=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'])),a.Text.encode(t.selector.getStoreTitle()),a.Text.encode(t.getPlaceholder()),a.Text.encode(t.selector.getStoreTitle()),t.handleNameInputHiddenChange.bind(t))}))}},{key:"getHiddenNameInput",value:function e(){var t=this;return this.cache.remember("hiddenNameInput",(function(){return a.Tag.render(h||(h=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'])),a.Text.encode(t.inputName),a.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 a.Tag.render(g||(g=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'])),t.handleClearIconClick.bind(t))}))}},{key:"getArrowIcon",value:function e(){var t=this;return this.cache.remember("arrowIcon",(function(){return a.Tag.render(p||(p=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'])),t.selector.getDetailPath())}))}},{key:"getSearchIcon",value:function e(){var t=this;return this.cache.remember("searchIcon",(function(){return a.Tag.render(b||(b=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'])),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=a.Tag.render(I||(I=babelHelpers.taggedTemplateLiteral(['<div class="ui-ctl ui-ctl-w100 ui-ctl-after-icon"></div>'])));a.Dom.append(this.getSearchIcon(),t);this.toggleIcon(this.getSearchIcon(),"none");a.Dom.append(this.getClearIcon(),t);this.toggleIcon(this.getClearIcon(),"none");if(this.showDetailLink()&&a.Type.isStringFilled(this.selector.getStoreTitle())){this.toggleIcon(this.getArrowIcon(),"block");a.Dom.append(this.getArrowIcon(),t)}else{this.toggleIcon(this.getSearchIcon(),"block")}a.Event.bind(this.getNameInput(),"click",this.handleNameInputClick.bind(this));a.Event.bind(this.getNameInput(),"input",this.handleNameInput.bind(this));a.Event.bind(this.getNameInput(),"blur",this.handleNameInputBlur.bind(this));a.Event.bind(this.getNameInput(),"keydown",this.handleNameInputKeyDown.bind(this));a.Dom.append(this.getNameBlock(),t);BX.UI.Hint.init(t);return t}},{key:"handleNameInputClick",value:function e(t){this.searchInDialog(t.target.value);this.handleIconsSwitchingOnNameInput(t)}},{key:"handleNameInput",value:function e(t){if(!a.Type.isStringFilled(t.target.value)){this.selector.onClear();return}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={title:a.Tag.message(v||(v=babelHelpers.taggedTemplateLiteral(["",""])),"CATALOG_STORE_SELECTOR_IS_EMPTY_TITLE")};if(t.allowCreateItem){e.subtitle=a.Tag.message(f||(f=babelHelpers.taggedTemplateLiteral(["",""])),"CATALOG_STORE_SELECTOR_IS_EMPTY_SUBTITLE");e.arrow=true}var i={id:t.id+"_store",height:300,context:"catalog-store",targetNode:t.getNameInput(),enableSearch:false,multiple:false,dropdownMode:true,searchTabOptions:{stubOptions:e,stub: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:t.allowCreateItem}};return new l.Dialog(i)}))}},{key:"handleNameInputKeyDown",value:function e(t){var i=this.getDialog();if(t.key==="Enter"&&i.getActiveTab()===i.getSearchTab()){t.preventDefault();if(a.Browser.isMac()&&t.metaKey||t.ctrlKey){i.getSearchTab().getFooter().createItem()}}}},{key:"handleIconsSwitchingOnNameInput",value:function e(t){this.toggleIcon(this.getArrowIcon(),"none");if(a.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 i=this.getDialog();if(i){i.show();i.search(t)}}},{key:"handleShowSearchDialog",value:function e(t){this.searchInDialog(t.target.value)}},{key:"handleNameInputBlur",value:function e(t){var i=this;setTimeout((function(){i.toggleIcon(i.getClearIcon(),"none");if(i.showDetailLink()&&a.Type.isStringFilled(i.selector.getStoreTitle())){i.toggleIcon(i.getSearchIcon(),"none");i.toggleIcon(i.getArrowIcon(),"block")}else{i.toggleIcon(i.getArrowIcon(),"none");i.toggleIcon(i.getSearchIcon(),"block")}}),200);if(this.selector.isDisabledEmpty()){setTimeout((function(){if(i.selector.getStoreId()===""){i.selector.setEmptyError()}else{i.selector.clearErrorLayout();i.selector.clearEmptyError()}}),200)}}},{key:"handleSearchIconClick",value:function e(t){this.searchInDialog();this.focusName();t.stopPropagation();t.preventDefault()}},{key:"onSearch",value:function e(t){var i=t.getData(),a=i.query;if(a===""||a===this.selector.getStoreTitle()){var l,r,n;(l=t.target)===null||l===void 0?void 0:(r=l.searchTab)===null||r===void 0?void 0:(n=r.getFooter())===null||n===void 0?void 0:n.hide()}else{var s,o,c;(s=t.target)===null||s===void 0?void 0:(o=s.searchTab)===null||o===void 0?void 0:(c=o.getFooter())===null||c===void 0?void 0:c.show()}}},{key:"onStoreSelect",value:function e(t){var i=t.getData().item;i.getDialog().getTargetNode().value=i.getTitle();if(this.selector){this.selector.onStoreSelect(i.getId(),i.getTitle())}this.toggleIcon(this.getSearchIcon(),"none");this.selector.clearLayout();this.selector.layout();this.cache["delete"]("dialog")}},{key:"createStore",value:function e(t){var i=t.getData(),l=i.searchQuery;var r=l.getQuery();return new Promise((function(e,i){if(!a.Type.isStringFilled(r)){i();return}var l=t.getTarget();l.showLoader();a.ajax.runAction("catalog.storeSelector.createStore",{json:{name:r}}).then((function(t){l.hideLoader();var i=a.Text.toInteger(t.data.id);var n=l.addItem({id:i,entityId:"store",title:r,tabs:l.getRecentTab().getId()});if(n){n.select()}l.hide();e()}))["catch"]((function(e){console.error(e);i()}))}))}},{key:"getPlaceholder",value:function e(){return a.Loc.getMessage("CATALOG_STORE_SELECTOR_BEFORE_SEARCH_TITLE")}},{key:"disable",value:function e(t){this.disableByRights=true;if(t){this.disabledHint=t}}}]);return e}();var T,E,y,S,k,C;function L(e,t,i){H(e,t);t.set(e,i)}function H(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}var D=new Map;var _=new WeakMap;var w=new WeakMap;var N=function(e){babelHelpers.inherits(t,e);babelHelpers.createClass(t,null,[{key:"getById",value:function e(t){return D.get(t)||null}}]);function t(e){var i;var l=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};babelHelpers.classCallCheck(this,t);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"mode",t.MODE_EDIT);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"productId",null);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"cache",new a.Cache.MemoryCache);L(babelHelpers.assertThisInitialized(i),_,{writable:true,value:new Map});L(babelHelpers.assertThisInitialized(i),w,{writable:true,value:void 0});i.setEventNamespace("BX.Catalog.StoreSelector");i.id=e||a.Text.getRandom();l.inputFieldTitle=l.inputFieldTitle||t.INPUT_FIELD_TITLE;l.inputFieldId=l.inputFieldId||t.INPUT_FIELD_ID;l.isDisabledEmpty=!!l.isDisabledEmpty;i.options=l||{};i.setMode(l.mode);var r=a.Extension.getSettings("catalog.store-selector");if(l.model instanceof s.ProductModel){if(l.model.getField(l.inputFieldId)>0){babelHelpers.classPrivateFieldGet(babelHelpers.assertThisInitialized(i),_).set("id",l.model.getField(l.inputFieldId));var n=a.Type.isStringFilled(l.model.getField(l.inputFieldTitle))?l.model.getField(l.inputFieldTitle):"";i.setProductId(l.model.getSkuId());babelHelpers.classPrivateFieldGet(babelHelpers.assertThisInitialized(i),_).set("title",n)}else if(!l.model.isCatalogExisted()){babelHelpers.classPrivateFieldGet(babelHelpers.assertThisInitialized(i),_).set("id",r.get("defaultStoreId"));babelHelpers.classPrivateFieldGet(babelHelpers.assertThisInitialized(i),_).set("title",r.get("defaultStoreName"))}babelHelpers.classPrivateFieldSet(babelHelpers.assertThisInitialized(i),w,l.model)}else{babelHelpers.classPrivateFieldGet(babelHelpers.assertThisInitialized(i),_).set("id",r.get("defaultStoreId"));babelHelpers.classPrivateFieldGet(babelHelpers.assertThisInitialized(i),_).set("title",r.get("defaultStoreName"))}i.searchInput=new m(i.id,{selector:babelHelpers.assertThisInitialized(i),inputName:i.options.inputFieldTitle,allowCreateItem:i.options.allowCreateItem||r.get("allowCreateItem"),disableByRights:r.get("disableByRights")});i.layout();D.set(i.id,babelHelpers.assertThisInitialized(i));return i}babelHelpers.createClass(t,[{key:"setMode",value:function e(i){if(!a.Type.isNil(i)){this.mode=i===t.MODE_VIEW?t.MODE_VIEW:t.MODE_EDIT}}},{key:"setProductId",value:function e(t){var i;t=a.Text.toNumber(t);if(t>0){this.productId=t}else{this.productId=null}(i=this.searchInput)===null||i===void 0?void 0:i.clearDialogCache()}},{key:"isViewMode",value:function e(){return this.mode===t.MODE_VIEW}},{key:"isDisabledEmpty",value:function e(){return this.options.isDisabledEmpty}},{key:"getId",value:function e(){return this.id}},{key:"getProductId",value:function e(){return this.productId}},{key:"getConfig",value:function e(t,i){return BX.prop.get(this.options.config,t,i)}},{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 i=a.Tag.render(T||(T=babelHelpers.taggedTemplateLiteral(['<div class="catalog-store-field-inner"></div>'])));a.Dom.append(i,t);a.Dom.append(this.getNameBlock(),i);a.Dom.append(this.getErrorBlock(),i);if(this.getStoreId()===""){this.layoutEmptyError()}}},{key:"setEmptyError",value:function e(){babelHelpers.classPrivateFieldGet(this,w).getErrorCollection().setError(o.NOT_SELECTED_STORE,a.Loc.getMessage("CATALOG_STORE_SELECTOR_UNSELECTED"));this.layoutEmptyError()}},{key:"clearEmptyError",value:function e(){babelHelpers.classPrivateFieldGet(this,w).getErrorCollection().removeError(o.NOT_SELECTED_STORE);return this}},{key:"layoutEmptyError",value:function e(){this.getErrorBlock().innerHTML="";a.Dom.append(a.Tag.render(E||(E=babelHelpers.taggedTemplateLiteral(['<div class="catalog-store-field-error">',"</div>"])),a.Loc.getMessage("CATALOG_STORE_SELECTOR_UNSELECTED")),this.getErrorBlock());if(this.searchInput){a.Dom.addClass(this.getNameBlock(),"ui-ctl-danger")}return this}},{key:"clearErrorLayout",value:function e(){this.getErrorBlock().innerHTML="";a.Dom.removeClass(this.getNameBlock(),"ui-ctl-danger");return this}},{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(),fields:[{NAME:this.options.inputFieldId,VALUE:null},{NAME:this.options.inputFieldTitle,VALUE:""}]})}},{key:"clearState",value:function e(){babelHelpers.classPrivateFieldGet(this,_).clear()}},{key:"clearLayout",value:function e(){var t=this.getWrapper();if(t){t.innerHTML=""}this.nameBlock=null;this.clearErrorLayout()}},{key:"unsubscribeEvents",value:function e(){}},{key:"defineWrapperClass",value:function e(t){if(this.isViewMode()){a.Dom.addClass(t,"catalog-store-view");a.Dom.removeClass(t,"catalog-store-edit")}else{a.Dom.addClass(t,"catalog-store-edit");a.Dom.removeClass(t,"catalog-store-view")}}},{key:"getViewHtml",value:function e(){var t=a.Text.encode(this.getStoreTitle());var i=a.Loc.getMessage("CATALOG_STORE_SELECTOR_VIEW_NAME_TITLE");if(this.getDetailPath()){return a.Tag.render(y||(y=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<a href="','" title="','">',"</a>\n\t\t\t"])),this.getDetailPath(),i,t)}return a.Tag.render(S||(S=babelHelpers.taggedTemplateLiteral(['<span title="','">',"</span>"])),i,t)}},{key:"getNameBlock",value:function e(){if(this.nameBlock){return this.nameBlock}var t=a.Tag.render(k||(k=babelHelpers.taggedTemplateLiteral(['<div class="catalog-store-field-input"></div>'])));if(this.isViewMode()){a.Dom.append(this.getViewHtml(),t)}else{a.Dom.append(this.searchInput.layout(),t)}this.nameBlock=t;return this.nameBlock}},{key:"getErrorBlock",value:function e(){if(!this.errorBlock){this.errorBlock=a.Tag.render(C||(C=babelHelpers.taggedTemplateLiteral(['<div class="catalog-store-field-error"></div>'])))}return this.errorBlock}},{key:"getStoreTitle",value:function e(){return babelHelpers.classPrivateFieldGet(this,_).get("title")||""}},{key:"getStoreId",value:function e(){return babelHelpers.classPrivateFieldGet(this,_).get("id")||""}},{key:"onStoreSelect",value:function e(t,i){if(i===""){i=a.Loc.getMessage("CATALOG_STORE_SELECTOR_EMPTY_STORE_TITLE")}babelHelpers.classPrivateFieldGet(this,_).set("id",t);babelHelpers.classPrivateFieldGet(this,_).set("title",i);this.clearLayout();this.clearEmptyError();this.layout();this.emit("onChange",{selectorId:this.id,rowId:this.getRowId(),fields:[{NAME:this.options.inputFieldId,VALUE:t},{NAME:this.options.inputFieldTitle,VALUE:i}]})}},{key:"getRowId",value:function e(){return this.getConfig("ROW_ID")}}]);return t}(i.EventEmitter);babelHelpers.defineProperty(N,"MODE_VIEW","view");babelHelpers.defineProperty(N,"MODE_EDIT","edit");babelHelpers.defineProperty(N,"INPUT_FIELD_TITLE","STORE_TITLE");babelHelpers.defineProperty(N,"INPUT_FIELD_ID","STORE_ID");babelHelpers.defineProperty(N,"ErrorCodes",o);e.StoreSelector=N})(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.27 |
proxy
|
phpinfo
|
Settings