Your IP : 172.69.214.232


Current Path : /var/www/element/data/www/revenuestory.ru/bitrix/js/ui/stageflow/dist/
Upload File :
Current File : /var/www/element/data/www/revenuestory.ru/bitrix/js/ui/stageflow/dist/stageflow.bundle.min.js

this.BX=this.BX||{};(function(e,t,i){"use strict";var a,n;var s=function(){function e(t){var i=t.id,a=t.name,n=t.color,s=t.backgroundColor,l=t.isFilled,r=t.events,o=t.isSuccess,c=t.isFail,g=t.fillingColor;babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"backgroundImage","url('data:image/svg+xml;charset=UTF-8,%3csvg width=%27295%27 height=%2732%27 viewBox=%270 0 295 32%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3e%3cmask id=%27mask0_2_11%27 style=%27mask-type:alpha%27 maskUnits=%27userSpaceOnUse%27 x=%270%27 y=%270%27 width=%27295%27 height=%2732%27%3e%3cpath fill=%27#COLOR2#%27 d=%27M0 2.9961C0 1.3414 1.33554 0 2.99805 0L285.905 7.15256e-07C287.561 7.15256e-07 289.366 1.25757 289.937 2.80757L295 16.5505L290.007 29.2022C289.397 30.7474 287.567 32 285.905 32H2.99805C1.34227 32 0 30.6657 0 29.0039V2.9961Z%27/%3e%3c/mask%3e%3cg mask=%27url(%23mask0_2_11)%27%3e%3cpath fill=%27#COLOR2#%27 d=%27M0 2.9961C0 1.3414 1.33554 0 2.99805 0L285.905 7.15256e-07C287.561 7.15256e-07 289.366 1.25757 289.937 2.80757L295 16.5505L290.007 29.2022C289.397 30.7474 287.567 32 285.905 32H2.99805C1.34227 32 0 30.6657 0 29.0039V2.9961Z%27/%3e%3cpath d=%27M0 30H295V32H0V30Z%27 fill=%27#COLOR1#%27/%3e%3c/g%3e%3c/svg%3e') 3 10 3 3 fill repeat");this.id=i;this.name=a;this.color=n;this.backgroundColor=s;this.isFilled=l;this.events=r;this.success=o;this.fail=c;this.fillingColor=g}babelHelpers.createClass(e,[{key:"getId",value:function e(){return this.id}},{key:"getName",value:function e(){return this.name}},{key:"setName",value:function e(t){this.name=t;if(this.textNode){this.textNode.innerText=this.name}return this}},{key:"isSuccess",value:function e(){return this.success===true}},{key:"isFail",value:function e(){return this.fail===true}},{key:"isFinal",value:function e(){return this.isFail()||this.isSuccess()}},{key:"getColor",value:function e(){return this.color}},{key:"setColor",value:function e(t){this.color=t;return this}},{key:"render",value:function i(){if(this.node){this.textNode.style.backgroundImage=this.getBackgroundImage()}else{this.textNode=t.Tag.render(a||(a=babelHelpers.taggedTemplateLiteral(['<div style="border-image: ',';" class="ui-stageflow-stage-item-text">',"</div>"])),this.getBackgroundImage(),t.Text.encode(this.getName()));this.node=t.Tag.render(n||(n=babelHelpers.taggedTemplateLiteral(['<div \n\t\t\t\t\tclass="ui-stageflow-stage" \n\t\t\t\t\tdata-stage-id="','" \n\t\t\t\t\tonmouseenter="','" \n\t\t\t\t\tonmouseleave="','"\n\t\t\t\t\tonclick="','"\n\t\t\t\t>\n\t\t\t\t<div class="ui-stageflow-stage-item">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t</div>"])),this.getId(),this.onMouseEnter.bind(this),this.onMouseLeave.bind(this),this.onClick.bind(this),this.textNode)}this.textNode.style.color=e.calculateTextColor("#"+(this.isFilled?this.color:this.backgroundColor));return this.node}},{key:"getBackgroundImage",value:function e(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;if(!i){if(this.isFilled&&this.fillingColor){i=this.fillingColor}else{i=this.getColor()}}if(t.Type.isNull(a)){a=this.isFilled}var n=this.backgroundImage.replaceAll("#COLOR1#",encodeURIComponent("#"+i));if(a){n=n.replaceAll("#COLOR2#",encodeURIComponent("#"+i))}else{n=n.replaceAll("#COLOR2#",encodeURIComponent("#"+this.backgroundColor))}return n}},{key:"onMouseEnter",value:function e(){if(t.Type.isFunction(this.events.onMouseEnter)){this.events.onMouseEnter(this)}}},{key:"onMouseLeave",value:function e(){if(t.Type.isFunction(this.events.onMouseLeave)){this.events.onMouseLeave(this)}}},{key:"onClick",value:function e(){if(t.Type.isFunction(this.events.onClick)){this.events.onClick(this)}}},{key:"addBackLight",value:function t(i){if(this.textNode){this.textNode.style.borderImage=this.getBackgroundImage(i,true);this.textNode.style.color=e.calculateTextColor("#"+i)}}},{key:"removeBackLight",value:function t(){if(this.textNode){this.textNode.style.borderImage=this.getBackgroundImage();this.textNode.style.color=e.calculateTextColor("#"+(this.isFilled?this.fillingColor:this.backgroundColor))}}}],[{key:"create",value:function i(a){if(t.Type.isPlainObject(a)&&a.id&&a.name&&a.color&&a.backgroundColor){a.id=t.Text.toInteger(a.id);a.name=a.name.toString();a.color=a.color.toString();a.backgroundColor=a.backgroundColor.toString();if(!t.Type.isPlainObject(a.events)){a.events={}}if(!t.Type.isBoolean(a.isFilled)){a.isFilled=false}if(a.id>0){return new e(a)}}return null}},{key:"calculateTextColor",value:function e(t){var i,a,n;if(t.length>7&&t.indexOf("(")>=0&&t.indexOf(")")>=0){var s=t.split("(")[1].split(")")[0];s=s.split(",");i=parseInt(s[0]);a=parseInt(s[1]);n=parseInt(s[2])}else{if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(t)){var l=t.substring(1).split("");if(l.length===3){l=[l[0],l[0],l[1],l[1],l[2],l[2]]}l="0x"+l.join("");i=l>>16&255;a=l>>8&255;n=l&255}}var r=.21*i+.72*a+.07*n;return r<145?"#fff":"#333"}}]);return e}();var l,r,o,c,g,u;function f(e,t){var i=typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=h(e))||t&&e&&typeof e.length==="number"){if(i)e=i;var a=0;var n=function e(){};return{s:n,n:function t(){if(a>=e.length)return{done:true};return{done:false,value:e[a++]}},e:function e(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s=true,l=false,r;return{s:function t(){i=i.call(e)},n:function e(){var t=i.next();s=t.done;return t},e:function e(t){l=true;r=t},f:function e(){try{if(!s&&i["return"]!=null)i["return"]()}finally{if(l)throw r}}}}function h(e,t){if(!e)return;if(typeof e==="string")return d(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);if(i==="Object"&&e.constructor)i=e.constructor.name;if(i==="Map"||i==="Set")return Array.from(e);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return d(e,t)}function d(e,t){if(t==null||t>e.length)t=e.length;for(var i=0,a=new Array(t);i<t;i++){a[i]=e[i]}return a}function S(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,a)}return i}function v(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?S(Object(i),!0).forEach((function(t){babelHelpers.defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):S(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var p="ui-stageflow-select-semantic-popup";var m="ui-stageflow-select-final-stage-popup";var y={id:"final",color:"7BD500",isFilled:false};var b={finalStageName:t.Loc.getMessage("UI_STAGEFLOW_FINAL_STAGE_NAME"),finalStagePopupTitle:t.Loc.getMessage("UI_STAGEFLOW_FINAL_STAGE_POPUP_TITLE"),finalStagePopupFail:t.Loc.getMessage("UI_STAGEFLOW_FINAL_STAGE_POPUP_FAIL"),finalStageSelectorTitle:t.Loc.getMessage("UI_STAGEFLOW_FINAL_STAGE_SELECTOR_TITLE")};var k=function(){function e(i){var a=this;var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"currentStage",0);babelHelpers.defineProperty(this,"isActive",false);this.labels=b;if(t.Type.isPlainObject(i)){if(t.Type.isString(i.backgroundColor)&&i.backgroundColor.length===6){this.backgroundColor=i.backgroundColor}if(i.currentStage){this.currentStage=t.Text.toInteger(i.currentStage)}if(t.Type.isBoolean(i.isActive)){this.isActive=i.isActive}if(t.Type.isFunction(i.onStageChange)){this.onStageChange=i.onStageChange}if(t.Type.isPlainObject(i.labels)){this.labels=v(v({},this.labels),i.labels)}}y.name=this.labels.finalStageName;if(t.Type.isArray(n)){var s=null;if(this.currentStage>0){n.forEach((function(e){if(t.Text.toInteger(e.id)===t.Text.toInteger(a.currentStage)){s=e.color}}))}this.fillStages(n,s)}if(!this.currentStage&&this.stages.length>0){this.currentStage=this.stages.keys().next().value}}babelHelpers.createClass(e,[{key:"setCurrentStageId",value:function e(i){i=t.Text.toInteger(i);var a=this.getStageById(i);if(!a){return}this.currentStage=i;var n=this.getFinalStage();if(n){if(a.isFinal()){n.setColor(a.getColor()).setName(a.getName())}else{n.setColor(y.color).setName(y.name)}}this.stages.forEach((function(e){if(!e.isFinal()){e.fillingColor=a.getColor()}}));this.addBackLightUpToStage();return this}},{key:"fillStages",value:function e(t,i){var a=this;var n=this.currentStage>0;var l={};this.stages=new Map;t.forEach((function(e){e.isFilled=n;e.backgroundColor=a.backgroundColor;e.fillingColor=i;e.events={onMouseEnter:a.onStageMouseHover.bind(a),onMouseLeave:a.onStageMouseLeave.bind(a),onClick:a.onStageClick.bind(a)};var t=s.create(e);if(t){a.stages.set(t.getId(),t)}if(t.isSuccess()){y.color=t.getColor()}if(t.isFinal()){l.isFilled=n;if(t.getId()===a.currentStage){l.name=t.getName();l.color=t.getColor()}}else if(n&&t.getId()===a.currentStage){n=false}}));if(this.getFailStages().length<=0){y.name=l.name=this.getSuccessStage().getName()}this.addFinalStage(l)}},{key:"addFinalStage",value:function e(t){this.stages.set(y.id,new s(v(v(v({},{backgroundColor:this.backgroundColor,events:{onMouseEnter:this.onStageMouseHover.bind(this),onMouseLeave:this.onStageMouseLeave.bind(this),onClick:this.onFinalStageClick.bind(this)}}),y),t)))}},{key:"getFinalStage",value:function e(){return this.getStageById(y.id)}},{key:"getStages",value:function e(){return this.stages}},{key:"getFirstFailStage",value:function e(){var t=null;this.stages.forEach((function(e){if(e.isFail()&&!t){t=e}}));return t}},{key:"getFailStages",value:function e(){var t=[];this.stages.forEach((function(e){if(e.isFail()){t.push(e)}}));return t}},{key:"getSuccessStage",value:function e(){var t=null;this.stages.forEach((function(e){if(e.isSuccess()){t=e}}));return t}},{key:"getStageById",value:function e(t){return this.stages.get(t)}},{key:"render",value:function e(){var t=this.renderContainer();this.getStages().forEach((function(e){if(e.isFinal()){return}t.appendChild(e.render())}));this.addBackLightUpToStage();return t}},{key:"renderContainer",value:function e(){if(this.container){t.Dom.clean(this.container);return this.container}this.container=t.Tag.render(l||(l=babelHelpers.taggedTemplateLiteral(['<div class="ui-stageflow-container"></div>'])));return this.container}},{key:"onStageMouseHover",value:function e(t){if(!this.isActive){return}var i=f(this.stages),a;try{for(i.s();!(a=i.n()).done;){var n=babelHelpers.slicedToArray(a.value,2),s=n[0],l=n[1];l.addBackLight(t.getColor());if(s===t.getId()){break}}}catch(e){i.e(e)}finally{i.f()}}},{key:"onStageMouseLeave",value:function e(t){if(!this.isActive){return}var i=f(this.stages),a;try{for(i.s();!(a=i.n()).done;){var n=babelHelpers.slicedToArray(a.value,2),s=n[0],l=n[1];l.removeBackLight();if(s===t.getId()){break}}}catch(e){i.e(e)}finally{i.f()}}},{key:"onStageClick",value:function e(i){if(!this.isActive){return}if(i.getId()!==this.currentStage&&t.Type.isFunction(this.onStageChange)){this.onStageChange(i)}var a=this.getSemanticSelectorPopup();if(a.isShown()){a.close()}}},{key:"onFinalStageClick",value:function e(t){if(!this.isActive){return}if(this.getFailStages().length<=0){this.onStageClick(this.getSuccessStage())}else{var i=this.getSemanticSelectorPopup();i.show();var a=this.getStageById(this.currentStage);this.isActive=false;if(!a.isFinal()){var n=this.getStageById(y.id);if(n){this.addBackLightUpToStage(n.getId(),n.getColor())}}}}},{key:"addBackLightUpToStage",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;if(!t){t=this.currentStage}var a=this.getStageById(t);if(a&&!i){i=a.getColor()}var n=!!t;this.stages.forEach((function(e){e.isFilled=n;if(e.isFilled){e.addBackLight(i?i:e.getColor())}else{e.removeBackLight()}if(!e.isFinal()&&n&&e.getId()===t){n=false}}))}},{key:"getSemanticSelectorPopup",value:function e(){var a=this;var n=i.PopupManager.getPopupById(p);if(!n){var s=this.getFailStageName();n=i.PopupManager.create({id:p,autoHide:true,closeByEsc:true,closeIcon:true,maxWidth:420,content:t.Tag.render(r||(r=babelHelpers.taggedTemplateLiteral(['<div class="ui-stageflow-popup-title">',"</div>"])),this.labels.finalStagePopupTitle),buttons:[new BX.UI.Button({color:BX.UI.Button.Color.SUCCESS,text:this.getSuccessStage().getName(),onclick:function e(){a.isActive=true;a.onStageClick(a.getSuccessStage())}}),s?new BX.UI.Button({color:BX.UI.Button.Color.DANGER,text:s,onclick:function e(){n.close();var t=a.getFinalStageSelectorPopup();t.show();a.isActive=false}}):null],events:{onClose:function e(){a.setCurrentStageId(a.currentStage);a.isActive=true}}})}return n}},{key:"getFinalStageSemanticSelector",value:function e(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;if(!this.finalStageSemanticSelector){this.finalStageSemanticSelector=t.Tag.render(o||(o=babelHelpers.taggedTemplateLiteral(['<div class="ui-stageflow-stage-selector-option ui-stageflow-stage-selector-option-fail" onclick="','"></div>'])),this.onSemanticSelectorClick.bind(this))}if(t.Type.isBoolean(i)){var a=null;var n=this.getFailStageName();if(i||!n){this.finalStageSemanticSelector.classList.add("ui-stageflow-stage-selector-option-success");this.finalStageSemanticSelector.classList.remove("ui-stageflow-stage-selector-option-fail");this.finalStageSemanticSelector.innerText=this.getSuccessStage().getName();a=this.getSuccessStage()}else{this.finalStageSemanticSelector.classList.add("ui-stageflow-stage-selector-option-fail");this.finalStageSemanticSelector.classList.remove("ui-stageflow-stage-selector-option-success");this.finalStageSemanticSelector.innerText=n;a=this.getFirstFailStage()}var s=this.getFinalStage();if(s&&a){s.setColor(a.getColor()).setName(a.getName())}this.addBackLightUpToStage(s.getId(),s.getColor())}return this.finalStageSemanticSelector}},{key:"getFinalStageSelectorPopup",value:function e(){var a=this;var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var s={};var l=t.Tag.render(c||(c=babelHelpers.taggedTemplateLiteral(['<div class="ui-stageflow-final-fail-stage-list-wrapper"></div>'])));if(!n){var r=this.getFailStages();if(r.length>1){var o=true;r.forEach((function(e){l.appendChild(t.Tag.render(g||(g=babelHelpers.taggedTemplateLiteral(['<div class="ui-stageflow-final-fail-stage-list-section">\n\t\t\t\t\t\t<input data-stage-id="','" id="ui-stageflow-final-fail-stage-','" name="ui-stageflow-final-fail-stage-input" class="crm-list-fail-deal-button" type="radio" ','>\n\t\t\t\t\t\t<label for="ui-stageflow-final-fail-stage-','">',"</label>\n\t\t\t\t\t</div>"])),e.getId(),e.getId(),o?'checked="checked"':"",e.getId(),e.getName()));o=false}))}}s.content=t.Tag.render(u||(u=babelHelpers.taggedTemplateLiteral(['<div class="ui-stageflow-stage-selector-block">\n\t\t\t<span>'," </span>\n\t\t\t","\n\t\t</div>"])),this.labels.finalStageSelectorTitle,this.getFinalStageSemanticSelector(n));var f=i.PopupManager.getPopupById(m);if(!f){f=i.PopupManager.create({id:m,autoHide:false,closeByEsc:true,closeIcon:true,width:420,titleBar:true,buttons:[new BX.UI.SaveButton({onclick:function e(){f.close();var t=a.getSelectedFinalStage();if(t){a.onStageClick(t)}}}),new BX.UI.CancelButton({onclick:function e(){f.close()}})],events:{onClose:function e(){a.setCurrentStageId(a.currentStage);a.isActive=true}}})}f.setContent(l);f.setTitleBar(s);return f}},{key:"onSemanticSelectorClick",value:function e(){var t=this;var a=this.getFailStageName();var n=i.MenuManager.create({id:"ui-stageflow-final-stage-semantic-selector",bindElement:this.getFinalStageSemanticSelector(),items:[{text:this.getSuccessStage().getName(),onclick:function e(){t.getFinalStageSelectorPopup(true);n.close()}},a?{text:a,onclick:function e(){t.getFinalStageSelectorPopup(false);n.close()}}:null]});n.show()}},{key:"getSelectedFinalStage",value:function e(){var i=this.getFinalStageSemanticSelector();if(i.classList.contains("ui-stageflow-stage-selector-option-success")){return this.getSuccessStage()}else{var a=this.getFailStages();if(a.length>1){var n=document.getElementById(m);if(n){var s=n.querySelector("input:checked");if(s){var l=this.getStageById(t.Text.toInteger(s.dataset.stageId));if(l){return l}}}}return this.getFirstFailStage()}}},{key:"getFailStageName",value:function e(){var t=this.getFailStages().length;if(t<=0){return null}else if(t===1){return this.getFirstFailStage().getName()}else{return this.labels.finalStagePopupFail}}}]);return e}();var C={Chart:k,Stage:s};e.StageFlow=C})(this.BX.UI=this.BX.UI||{},BX,BX.Main);
//# sourceMappingURL=stageflow.bundle.map.js