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/rospirotorg.ru/bitrix/js/bizproc/ |
Upload File : |
if(!BX.getClass("BX.Bizproc.FieldType"))(function(e){"use strict";e.namespace("BX.Bizproc");var t=function(e){return e.Multiple===true};const r=function(e){return e.AllowSelection!==false};var o=function(t){if(!e.type.isArray(t)){return[t]}return t};var i=function(t){if(e.Type.isArray(t)){return t.map((e=>e?e.replace(/(\s\[-?[0-9]+\])$/,""):""))}return t?t.replace(/(\s\[-?[0-9]+\])$/,""):""};const n=(e,r)=>{const i=o(e);if(t(r)){return i}return i.join(",")};var a=function(e){return e.Options?e.Options:{}};var s=function(t){let r="";if(!e.Type.isUndefined(t.Placeholder)){r=String(t.Placeholder)}return r};var l={isBaseType:function(e){switch(e){case"bool":case"UF:boolean":case"select":case"internalselect":case"date":case"UF:date":case"datetime":case"text":case"int":case"double":case"string":case"user":case"time":return true}return false},renderControlCollection:function(t,r,o,i={}){let n={};if(e.Type.isArrayFilled(r)){const a=[];const s=100;let l=0;while(l<r.length){const e=Math.min(l+s,r.length);a.push(r.slice(l,e));l=e}const c=!o||o==="public";const p=[];for(const r of a){const a=this.renderControlCollectionInner(t,r,o);n={...n,...a.rendered};const s=new Promise(((r,n)=>{e.ajax.runAction("bizproc.fieldtype.renderControlCollection",{json:{context:i,documentType:t,controlsData:a.toLoad.map((e=>({property:e.data.property,params:{Field:{Field:e.data.fieldName,Form:"sfa_form"},Value:e.data.value||"",Als:c?0:1,RenderMode:o==="designer"?"designer":"public"}})))}}).then(this.renderControlForCollection.bind(this,a,c)).then(r).catch((t=>{if(e.Type.isArrayFilled(t.errors)){const r=t.errors[0];if(e.Type.isStringFilled(r.message)){e.UI.Dialogs.MessageBox.alert(r.message)}if(e.Type.isPlainObject(r.customData)&&e.Type.isStringFilled(r.customData.reason)){console.error(r.customData.reason)}}n()}))}));p.push(s)}Promise.all(p).catch((()=>{})).finally((()=>{e.Event.EventEmitter.emit("BX.Bizproc.FieldType.onCollectionRenderControlFinished")}))}return n},renderControlForCollection(t,r,o){const i=o.data?.html;if(!e.Type.isArrayFilled(i)){return Promise.resolve()}const n=[];i.forEach(((o,i)=>{const a=t.toLoad[i].node;e.Dom.clean(a);const s=e.Runtime.html(a,o);if(!e.Type.isString(s)){n.push(s);s.then((()=>{if(r){this.initControl(a,t.toLoad[i].data.property)}else if(!e.Type.isNil(e.Bizproc.Selector)){e.Bizproc.Selector.initSelectors(a)}})).catch((()=>{}))}}));return Promise.all(n)},renderControlCollectionInner:function(t,r,o){const i={rendered:{},toLoad:[]};const n=!o||o==="public";r.forEach((r=>{const a=e.Type.isStringFilled(this.getRenderFunctionName(r.property));let s=null;if(!n||!a){s=e.Dom.create("div",{text:"..."});i.toLoad.push({node:s,data:r})}else{s=this.renderControl(t,r.property,r.fieldName,r.value,o)}i.rendered[r.controlId]=s}));return i},renderControl:function(t,r,o,i,n){if(!n||n==="public"){return this.renderControlPublic(t,r,o,i)}if(n==="designer"){return this.renderControlDesigner(t,r,o,i)}return e.create("div",{text:"incorrect render mode"})},renderControlPublic:function(r,i,n,a,s){var l,c=this.getRenderFunctionName(i);if(!e.Type.isBoolean(s)){s=true}if(e.type.isString(r)){r=r.split("@")}if(c){if(t(i)&&i.Type!=="select"){var p=[],d=this;o(a).forEach((function(e){p.push(d[c](i,n,e,r))}));if(p.length<=0){p.push(d[c](i,n,null,r))}l=this.wrapMultipleControls(i,n,p)}else{l=e.create("div",{children:[this[c](i,n,a,r)]})}}else{l=e.create("div",{text:"..."});s=false;e.ajax.runAction("bizproc.fieldtype.renderControl",{data:{documentType:r,property:i,params:{Field:{Field:n,Form:"sfa_form"},Value:a||"",Als:0,RenderMode:"public"}}}).then((t=>{e.Runtime.html(l,t.data.html).then((()=>{this.initControl(l,i);e.Event.EventEmitter.emit("BX.Bizproc.FieldType.onCustomRenderControlFinished",{fieldName:n})}))}),(t=>{e.UI.Dialogs.MessageBox.alert(t.errors[0].message);e.Event.EventEmitter.emit("BX.Bizproc.FieldType.onCustomRenderControlFinished",{fieldName:n})}))}if(s&&l){this.initControl(l,i)}return l},renderControlDesigner:function(t,r,o,i){var n=e.create("div",{text:"..."});e.ajax.runAction("bizproc.fieldtype.renderControl",{data:{documentType:t,property:r,params:{Field:{Field:o,Form:"sfa_form"},Value:i||"",Als:1,RenderMode:"designer"}}}).then((t=>{e.Runtime.html(n,t.data.html).then((()=>{if(typeof e.Bizproc.Selector!=="undefined"){e.Bizproc.Selector.initSelectors(n)}}))}),(t=>{e.UI.Dialogs.MessageBox.alert(t.errors[0].message)}));return n},formatValuePrintable:function(t,r){let o;switch(t["Type"]){case"bool":case"UF:boolean":o=e.message(r==="Y"?"BIZPROC_JS_BP_FIELD_TYPE_YES":"BIZPROC_JS_BP_FIELD_TYPE_NO");break;case"select":case"internalselect":var a=t["Options"]||{};if(e.type.isArray(r)){o=[];r.forEach((function(e){o.push(a[e])}));o=o.join(", ")}else{o=a[r]}break;case"date":case"UF:date":case"datetime":o=i(r);break;case"text":case"int":case"double":case"string":o=r.toString();break;case"user":o=[];var s,l,c,p,d=e.Type.isArray(r)?r:r.split(",");const u=(e,t)=>t.BaseType==="user"&&(t.Expression===e||t.SystemExpression===e);for(s=0;s<d.length;++s){c=e.util.trim(d[s]);if(p=c.match(/(.*)\[([A-Z]{0,2}\d+)\]/)){l=e.util.trim(p[1]);o.push(l)}else{const t=c;let r=this.getDocumentFields().find((e=>u(t,e)));if(!e.Type.isNil(r)){o.push(r.Name||t);continue}r=this.getGlobals().find((e=>u(t,e)));if(!e.Type.isNil(r)){o.push(r.Name||t);continue}o.push(t)}}o=o.join(", ");break;case"UF:address":let m=r;if(e.Type.isArrayFilled(m)){m=m[0]??""}if(e.Type.isStringFilled(m)){const e=m.match(/(.*)\|[\d.]*;[\d.]*\|?\d*/);if(e){m=String(e[1]).trim()}o=m}else{o=""}break;case"time":o=n(r,t);break;default:if(e.type.isString(r)){o=r}else{o="(?)"}break}return o},getRenderFunctionName:function(e){let t=null;switch(e.Type){case"B":case"bool":case"UF:boolean":t="createBoolNode";break;case"date":case"UF:date":case"datetime":case"S:Date":case"S:DateTime":t="createDateNode";break;case"L":case"select":t="createSelectNode";break;case"T":case"text":t="createTextNode";break;case"N":case"int":case"double":t="createNumericNode";break;case"S":case"string":t="createStringNode";break;case"F":case"file":t="createFileNode";break;case"time":t="createTimeNode";break}return t},wrapMultipleControls:function(t,r,o){var i=e.create("div",{children:o});var n=e.create("a",{attrs:{className:"bizproc-type-control-clone-btn"},text:e.message("BIZPROC_JS_BP_FIELD_TYPE_ADD"),events:{click:function(e){e.preventDefault();l.cloneControl(t,r,this.parentNode)}}});i.appendChild(e.create("div",{children:[n]}));return i},cloneControl:function(t,r,o){var i=this.getRenderFunctionName(t);if(i){var n=this[i](t,r);if(n&&o.parentNode){var a=e.create("div",{children:[n]});this.initControl(a,t);o.parentNode.insertBefore(a,o)}}},createControlOptions:function(t,r){var o=a(t);var i="";for(var n in o){if(String(n)!==String(o[n])){i+="["+n+"]"+o[n]}else{i+=o[n]}i+="\n"}var s=e.util.getRandomString(3);var l=e.create("textarea",{attrs:{id:"bizproc_fieldtype_select_form_options_"+s}});l.innerHTML=e.util.htmlspecialchars(i);var c=this;var p=e.create("button",{attrs:{type:"button"},text:e.Loc.getMessage("BIZPROC_JS_BP_FIELD_TYPE_SELECT_OPTIONS3"),events:{click:function(){r(c.parseSelectFormOptions(s))}}});var d=e.create("div");d.appendChild(l);d.appendChild(e.create("br"));d.innerHTML+=e.Loc.getMessage("BIZPROC_JS_BP_FIELD_TYPE_SELECT_OPTIONS1");d.appendChild(e.create("br"));d.innerHTML+=e.Loc.getMessage("BIZPROC_JS_BP_FIELD_TYPE_SELECT_OPTIONS2");d.appendChild(e.create("br"));d.appendChild(p);return d},parseSelectFormOptions:function(t){var r={};var o=document.getElementById("bizproc_fieldtype_select_form_options_"+t).value;if(!o){return r}var i=o.split(/[\r\n]+/);var n=/\[([^\]]+)].+/;for(var a in i){var s=e.util.trim(i[a]);if(s.length>0){var l=s.match(n);if(l){var c=s.indexOf("]");r[l[1]]=s.substr(c+1)}else{r[s]=s}}}return r},createBoolNode:function(r,o,i){var n=e.message("BIZPROC_JS_BP_FIELD_TYPE_YES");var a=e.message("BIZPROC_JS_BP_FIELD_TYPE_NO");n=n.charAt(0).toUpperCase()+n.slice(1);a=a.charAt(0).toUpperCase()+a.slice(1);var s=e.create("select",{attrs:{className:"bizproc-type-control bizproc-type-control-bool"+(t(r)?" bizproc-type-control-multiple":"")},props:{name:o+(t(r)?"[]":"")},children:[e.create("option",{props:{value:""},text:e.message("BIZPROC_JS_BP_FIELD_TYPE_NOT_SELECTED")})]});var l=e.create("option",{props:{value:"Y"},text:n});if(i==="Y"||i===1||i==="1"){l.setAttribute("selected","selected")}var c=e.create("option",{props:{value:"N"},text:a});if(i==="N"||i===0||i==="0"){c.setAttribute("selected","selected")}s.appendChild(l);s.appendChild(c);return s},createDateNode:function(o,n,a){var l=o["Type"];if(l==="UF:date"||l==="S:Date"){l="date"}if(l==="S:DateTime"){l="datetime"}var c=e.create("input",{attrs:{className:"bizproc-type-control bizproc-type-control-"+l+(t(o)?" bizproc-type-control-multiple":""),"data-role":r(o)?"inline-selector-target":"","data-selector-type":l,placeholder:s(o)},props:{type:"text",name:n+(t(o)?"[]":""),value:i(a)}});var p=e.getClass("BX.Bizproc.Automation.Designer")&&e.Bizproc.Automation.Designer.getInstance();var d=p&&(p.getRobotSettingsDialog()||p.getTriggerSettingsDialog());if(!d){var u=e.create("img",{attrs:{src:"/bitrix/js/main/core/images/calendar-icon.gif",className:"calendar-icon",border:"0"},events:{click:function(t){t.preventDefault();e.calendar({node:this,field:c,bTime:l==="datetime",bHideTime:l==="date"})}}});var m;if(o["Settings"]&&o["Settings"]["timezones"]){m=e.create("select",{props:{name:"tz_"+(n+(t(o)?"[]":""))},attrs:{className:"bizproc-type-control-date-lc"}});o["Settings"]["timezones"].forEach((function(t){var r=e.create("option",{props:{value:t.value},text:t.text});if(t.value==="current"){r.setAttribute("selected","selected")}m.appendChild(r)}))}return e.create("div",{children:[c,u,m]})}return c},createNumericNode:function(o,i,n){return e.create("input",{attrs:{className:"bizproc-type-control bizproc-type-control-int"+(t(o)?" bizproc-type-control-multiple":""),"data-role":r(o)?"inline-selector-target":"",placeholder:s(o)},props:{type:"text",name:i+(t(o)?"[]":""),value:e.Type.isNil(n)?"":n.toString()}})},createStringNode:function(o,i,n){return e.create("input",{attrs:{className:"bizproc-type-control bizproc-type-control-string"+(t(o)?" bizproc-type-control-multiple":""),"data-role":r(o)?"inline-selector-target":"",placeholder:s(o)},props:{type:"text",name:i+(t(o)?"[]":""),value:n||""}})},createFileNode:function(o,i,n){var a=e.getClass("BX.Bizproc.Automation.Designer")&&e.Bizproc.Automation.Designer.getInstance();var s=a&&a.getRobotSettingsDialog();if(!s){var l=e.create("input",{props:{type:"file",name:i+(t(o)?"[]":""),value:n||""},events:{change:function(){this.nextSibling.textContent=e.Bizproc.FieldType.File.parseLabel(this.value)}}});var c=e.create("span",{children:[e.create("span",{attrs:{className:"webform-small-button"},text:e.message("BIZPROC_JS_BP_FIELD_TYPE_CHOOSE_FILE")})]});return e.create("div",{children:[c,l,e.create("span",{attrs:{className:"bizproc-type-control-file-label"}})],attrs:{className:"bizproc-type-control bizproc-type-control-file"+(t(o)?" bizproc-type-control-multiple":"")}})}return e.create("input",{attrs:{className:"bizproc-type-control bizproc-type-control-file-selectable"+(t(o)?" bizproc-type-control-multiple":""),"data-role":r(o)?"inline-selector-target":"","data-selector-type":"file"},props:{type:"text",name:i+(t(o)?"[]":""),value:n||""}})},createTextNode:function(o,i,n){return e.create("textarea",{attrs:{className:"bizproc-type-control bizproc-type-control-text"+(t(o)?" bizproc-type-control-multiple":""),"data-role":r(o)?"inline-selector-target":"",rows:5,cols:40,placeholder:s(o)},props:{name:i+(t(o)?"[]":""),value:n||""}})},createSelectNode:function(r,o,i,n){var a=function(t,r){if(!t||!r){return false}if(e.type.isArray(r)){return e.util.in_array(t,r)}return t.toString()===r.toString()};var s,l=e.create("select",{attrs:{className:"bizproc-type-control bizproc-type-control-select"+(t(r)?" bizproc-type-control-multiple":"")},props:{name:o+(t(r)?"[]":"")}});var c=function(){return e.create("option",{props:{value:""},text:r.EmptyValueText||e.message("BIZPROC_JS_BP_FIELD_TYPE_NOT_SELECTED")})};if(t(r)){l.setAttribute("multiple","multiple");l.setAttribute("size","5")}s=c();if(e.Type.isNil(i)||i.length===0){s.setAttribute("selected","selected")}l.appendChild(s);const p=t=>{t.forEach(((t,r)=>{let o=r;let n=t;if(e.Type.isPlainObject(t)){o=t.value;n=t.name}const s=e.create("option",{props:{value:o},text:e.Text.decode(n)});if(a(o,i)){s.setAttribute("selected","selected")}l.appendChild(s)}))};if(e.type.isPlainObject(r["Options"])){const e=[];for(const t in r["Options"]){if(!r["Options"].hasOwnProperty(t)){continue}e.push({value:t,name:r["Options"][t]})}p(e)}else if(e.type.isArray(r["Options"])){p(r["Options"])}else if(r.Settings&&r.Settings.OptionsLoader&&r.Settings.OptionsLoader.type==="component"){const t=r.Settings.OptionsLoader;const o=e.create("option",{props:{value:"..."},text:"..."});l.appendChild(o);e.ajax.runComponentAction(t.component,t.action,{mode:t.mode||undefined,data:{documentType:n,property:r}}).then((t=>{if(e.Type.isArray(t.data.options)){e.Dom.remove(o);p(t.data.options)}}))}return l},createTimeNode:function(o,i,n){const a=e.Dom.create("INPUT",{attrs:{type:"text",autocomplete:"off","data-role":r(o)?"inline-selector-time":"","data-selector-type":"time"},props:{className:`bizproc-type-control bizproc-type-control-time${t(o)?" bizproc-type-control-multiple":""}`,name:i+(t(o)?"[]":""),value:n||""}});return e.Dom.create("DIV",{children:[a]})},initControl:function(t,r){var o=e.getClass("BX.Bizproc.Automation.Designer")&&e.Bizproc.Automation.Designer.getInstance();var i;var n=t.querySelectorAll("[data-role]");if(o&&o.getRobotSettingsDialog()){i=o.getRobotSettingsDialog();i.template.initRobotSettingsControls(i.robot,t)}else if(o&&o.getTriggerSettingsDialog()){i=o.getTriggerSettingsDialog();i.triggerManager.initSettingsDialogControls(t)}else if(r&&r["Type"]==="user"&&e.Bizproc.UserSelector){e.Bizproc.UserSelector.decorateNode(t.querySelector('[data-role="user-selector"]'))}else if(n.length>0){const t=e.Bizproc.Automation&&e.Bizproc.Automation.tryGetGlobalContext&&e.Bizproc.Automation.tryGetGlobalContext();if(t){n.forEach((function(r){var o=e.Bizproc.Automation.SelectorManager.createSelectorByRole(r.getAttribute("data-role"),{context:new e.Bizproc.Automation.SelectorContext({fields:e.clone(t.document.getFields()),useSwitcherMenu:t.get("showTemplatePropertiesMenuOnSelecting"),rootGroupTitle:t.document.title,userOptions:t.userOptions})});if(o&&r.parentNode){r.parentNode.replaceChild(o.renderWith(r),r)}}))}}},getDocumentFields:function(){const t=e.getClass("BX.Bizproc.Automation.Designer")&&e.Bizproc.Automation.Designer.getInstance();const r=t&&t.component;if(r){return r.data["DOCUMENT_FIELDS"]}if(e.getClass("BX.Bizproc.Automation.API.documentFields")){return e.Bizproc.Automation.API.documentFields}return[]},getDocumentUserGroups:function(){if(e.getClass("BX.Bizproc.Automation.API.documentUserGroups")){return e.Bizproc.Automation.API.documentUserGroups}return[]},getGlobals:function(){const t=e.Bizproc.Automation&&e.Bizproc.Automation.tryGetGlobalContext&&e.Bizproc.Automation.tryGetGlobalContext();return t&&t.automationGlobals?t.automationGlobals.globalVariables.concat(t.automationGlobals.globalConstants):[]}};l.File={parseLabel:function(e){var t;if(e.lastIndexOf("\\")){t=e.lastIndexOf("\\")+1}else{t=e.lastIndexOf("/")+1}return e.slice(t)}};e.Bizproc.FieldType=l})(window.BX||window.top.BX); //# sourceMappingURL=fieldtype.map.js