cronapp-framework-js 3.2.1-SP.23 → 3.2.1-SP.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,4 +52,4 @@ maskDirectiveAsDate.$inject=["$compile","$translate","$parse"],maskDirectiveMask
52
52
  ${s} ${c} ${r}
53
53
  </a>
54
54
  ${a(e.menuItems)}
55
- </li>`}),i},link:function(a,n,i){var o=this.populateMenu;i.$observe("options",function(d){t.onReady(()=>{let t=n.closest(".crn-navigator-vertical").length;var r={};try{r=JSON.parse(d)}catch(t){console.log("CronDynamicMenu: Invalid configuration!")}let l=r&&r.subMenuOptions&&r.subMenuOptions.length?r.subMenuOptions[0].id:"first";var s=`<ul id="menu-tag-ul-base-${l}" class="nav navbar-nav ${t?"col-md-12 padding-0":""}" ></ul>`,c=$(s);c.attr("id",i.id);var p=o(r,t);c.append(p),t&&c.append($("#navbar2 li:first").addClass("col-md-12 padding-0"));var u=angular.element(c);n.html(""),n.append(c),n.attr("id",null),e(u)(a);var m=i.multilevelAction;"hover"===m&&($(".dropdown-menu .dropdown-submenu").on("mouseover",function(){var e=$(this).children("ul.dropdown-menu");e.addClass("displayBlock")}),$(".dropdown-menu .dropdown-submenu").on("mouseout",function(){var e=$(this).children("ul.dropdown-menu");e.removeClass("displayBlock")})),"click"===m&&$(".dropdown-menu a.dropdown-toggle").on("click",function(t){$(this).next().hasClass("show")||$(this).parents(".dropdown-menu").first().find(".show").removeClass("show");var e=$(this).next(".dropdown-menu");return e.toggleClass("show"),$(this).parents("li.nav-item.dropdown").on("hidden.bs.dropdown",function(t){$(".dropdown-submenu .show").removeClass("show")}),!1}),$("#checkCollapsibleMenu").on("click",function(){var e=document.getElementById("main-view");this.checked?e.classList.remove("main-view-retratil"):e.classList.add("main-view-retratil")});let g=n.closest("nav");if(g&&g.length){let e=!g.hasClass("submenu-click"),t=g.attr("id");if(t||(t=app.common.generateId(),g.attr("id",t)),e){let e=$(`#${t} .dropdown-submenu`).data("hooked");e||($(`#${t} .dropdown-submenu`).on("mouseenter",function(t){$(this).children(".dropdown-menu").addClass("show")}).on("mouseleave",function(t){$(this).children(".dropdown-menu").removeClass("show")}),$(`#${t} .dropdown-submenu`).data("hooked",!0))}else{let e=$(`#${t} .dropdown-menu a.dropdown-toggle`).data("hooked");e||($(`#${t} .dropdown-menu a.dropdown-toggle`).on("click",function(t){$(this).next().hasClass("show")||$(this).parents(".dropdown-menu").first().find(".show").removeClass("show");var e=$(this).next(".dropdown-menu");return e.toggleClass("show"),$(this).parents("li.nav-item.dropdown.show").on("hidden.bs.dropdown",function(t){$(".dropdown-submenu .show").removeClass("show")}),!e.length&&void $(".dropdown-menu").removeClass("show")}),$(`#${t} .dropdown-menu a.dropdown-toggle`).data("hooked",!0));let a=$(`#${t} .dropdown.nav-item`).data("hooked");a||($(`#${t} .dropdown.nav-item`).on("hidden.bs.dropdown",function(t){$(".dropdown-submenu .show").removeClass("show"),$(".dropdown-menu .show").removeClass("show")}),$(`#${t} .dropdown.nav-item`).data("hooked",!0))}}else{let e=$(n).find("ul:first").attr("id"),t=$(`#${e} .dropdown-submenu`).data("hooked");t||($(`#${e} .dropdown-submenu`).on("mouseenter",function(t){$(this).children(".dropdown-menu").addClass("show")}).on("mouseleave",function(t){$(this).children(".dropdown-menu").removeClass("show")}),$(`#${e} .dropdown-submenu`).data("hooked",!0))}})})}}}]).directive("cronBreadcrumbs",["$rootScope",function(e){"use strict";return{restrict:"E",replace:!0,link:function(e,t,a){let n=a.ngInit?a.ngInit:null,i=[];const o=a.crnDelimiterIcon,d=a.typeMenu,r=a.idMenu?a.idMenu:null,l=a.id,s=a.breadcrumbIcon?a.breadcrumbIcon:null,c=()=>{const e=$(`#${l}`);e.data("kendoBreadcrumb")&&(e.data("kendoBreadcrumb").destroy(),e.empty())},p=async()=>{const t=n.replace("cronapi.client('js.","blockly.js.");n=t.replace("').run()",""),n=e.$eval(n),i=await n();const a=async t=>{t.item.action&&t.item.action()};c(),$(`#${l}`).kendoBreadcrumb({items:i,delimiterIcon:o,navigational:!0,click:a})},u=e=>e?e.replace("cronapi.screen.changeView('","").replace("', [])",""):"#/home";if(n&&"idBloco"===d)p();else{var m=new MutationObserver((e,t)=>{const a=$(`#${r}`).parent(),n=a.attr("options");if(n){t.disconnect();const e=JSON.parse(n),a=document.location.hash||"home",r=(e,t,a=[])=>{for(let o=0;o<e.length;o++){var n=e[o];if(n.action=u(n.action),n.action===t)return[...a,n];if(n.menuItems){const e=r(n.menuItems,t,[...a,n]);if(e)return e}}return null},s=r(e.subMenuOptions,a);if(s){for(var d in i=[],s){const e=s[d];i.push({type:0==d?"rootitem":"item",href:e.action,text:e.title,showText:!0,showIcon:!1})}c(),$(`#${l}`).kendoBreadcrumb({items:i,delimiterIcon:o,navigational:!0})}}});m.observe(document.body,{childList:!0,attributes:!0,subtree:!0})}}}}]).directive("ngInitialValue",["$parse",function(e){return{restrict:"A",require:"ngModel",link:async function(t,a,n,i){if(n.ngInitialValue){var o,d=e(n.ngModel),r=d.assign;try{if(-1!=n.ngInitialValue.indexOf("cronapi.client('js.")){let e=n.ngInitialValue.replace("cronapi.client('js.","blockly.js."),a=e.split("').names")[0];a=a.split("').attr()")[0];let i=e.split(".run")[1];o=await t.$eval(a+i)}else o=t.$eval(n.ngInitialValue)||n.ngInitialValue}catch(t){o=n.ngInitialValue}"checkbox"==a[0].type&&o&&(o="true"==(""+o).toLowerCase()),r(t,o)}}}}]).directive("crnSetIndeterminate",["$parse",function($parse){return{restrict:"A",link:function(scope,element,attrs){let value=eval(attrs.crnSetIndeterminate);null===value&&$(element).prop("indeterminate",!0)}}}]).directive("crnAllowNullValues",[function(){return{restrict:"A",require:"?ngModel",link:function(e,t,a,n){n.$formatters=[],n.$parsers=[];let i=e=>(e&&-1===e.indexOf("'")&&(e=`'${e}'`),e);a.ngFalseValue=i(a.ngFalseValue),a.ngTrueValue=i(a.ngTrueValue);let o=!!a.ngFalseValue&&a.ngFalseValue.split("'").join(""),d=!a.ngTrueValue||a.ngTrueValue.split("'").join(""),r=e=>"true"===e||void 0===e||null===e||0==e.length;n.$render=r(a.crnAllowNullValues)?function(){let e=n.$viewValue;t.data("checked",e),!0===e||e===d?(t.prop("indeterminate",!1),t.prop("checked",!0),e=d):!1===e||e===o?(t.prop("indeterminate",!1),t.prop("checked",!1),e=o):(e=null,t.prop("indeterminate",!0)),setTimeout(()=>n.$setViewValue(e))}:function(){let i=n.$viewValue;if((void 0===n.$viewValue||null===n.$viewValue)&&(n.$setViewValue(!1),i=!1),i===o){let n=a.ngFalseValue?`${t.attr("ng-model")}=${a.ngFalseValue}`:`${t.attr("ng-model")}=${o}`;e.$eval(n)}switch(t.data("checked",i),i){case!0:case d:t.prop("indeterminate",!1),t.prop("checked",!0),i=d;break;default:t.prop("indeterminate",!1),t.prop("checked",!1),i=o}setTimeout(()=>n.$setViewValue(i))},t.bind("click",function(){let i;switch(t.data("checked")){case!1:case o:i=!a.ngTrueValue||d;break;default:i=!!a.ngFalseValue&&o}n.$setViewValue(i),e.$apply(n.$render)})}}}]).directive("signaturePad",["$compile","$window",function(e,t){"use strict";var a,n,i=null;return{restrict:"E",require:"ngModel",scope:!0,replace:!0,transclude:!0,template:"<div style=\"height: 100%; width: 100%;\"> <canvas style=\"width:100%; height: 100%;\" ng-click=\"mouseup()\" ng-mouseup=\"mouseup()\"></canvas> <div class=\"component-holder ng-scope col-md-2\" style=\"bottom: 0; position: absolute; padding-left: 5px;\" data-component=\"crn-button\"> <button class=\"btn k-button btn-warning\" ng-click=\"clear()\" xattr-fullsize=\"\" xattr-theme=\"btn-warning\" xattr-disabled=\"\"> <i class=\"glyphicon glyphicon-erase\" icon-theme=\"\"></i> <span class=\"\" text-theme=\"\">{{'clear'|translate}}</span> </button> </div> </div>",scope:{dataurl:"=",ngClick:"@",ngModel:"="},controller:["$scope",function(t){let a=()=>{let e=t.signaturePad.toDataURL();return e&&(e=e.split(",")[1]),e};t.mouseup=function(n){t.signaturePad.isEmpty()||(t.ngModel=a())},t.$watch("ngModel",function(e,n){e!==n&&(a()!==e&&t.signaturePad.fromDataURL("data:image/png;base64,"+e,{ratio:1}),t.ngModel=e)},!0),t.clear=function(){t.signaturePad.clear(),t.ngModel=null}}],link:function(n,i,o,d,r){a=i.find("canvas")[0],n.onResize=function(){var e=Math.max(t.devicePixelRatio||1,1),a=i.find("canvas")[0],n=document.createElement("canvas");n.width=a.width,n.height=a.height;var o=n.getContext("2d");o.drawImage(a,0,0),a.width=a.offsetWidth*e,a.height=a.offsetHeight*e,a.getContext("2d").drawImage(n,0,0),a.getContext("2d").scale(e,e)},n.onResize(),n.signaturePad=new SignaturePad(a),angular.element(t).on("resize",function(){n.onResize()}),e(i)(i.scope());let l=!1;$(a).on("pointerdown",t=>{1===t.which&&(l=!0),t.preventDefault()}),$(a).on("pointerup",t=>{1===t.which&&l&&(l=!1,r(()=>angular.element(a).triggerHandler("mouseup")))})}}}]).directive("cronChat",["$compile","$translate",function(e,t){return{restrict:"E",replace:!0,link:function(e,t,a,n){var i=JSON.parse(a.options||"{}");if(i.token&&i.urlCronchat){var o=i.urlCronchat.endsWith("/")?i.urlCronchat:i.urlCronchat+"/",d=i.token,r=$(`<script src="${o}get-chat?token=${d}" type="text/javascript"></script>`);t.html(r)}}}}]).directive("updateLanguage",["$rootScope",function(e){return{link:function(t,a){var n=function(e,t){var n="en",i=t.language;"pt_br"===i?i="pt-br":i.startsWith("en")&&(i="en"),a.attr("lang",i||"en")};e.$on("$translateChangeSuccess",n)}}}]).directive("cronFrame",cronFrame).directive("crnComponent",cronFrame).directive("fromGrid",["$compile",e=>({restrict:"A",priority:-999999,exist:e=>{let t=e.attr("id");return $(`#${t}`).length},isFromGrid:e=>"true"===e.fromGrid,isCompiled:e=>e.data("alreadycompiled"),getDateAs:function(e,t,a){let n=e.data("mask"),i=e.data("useUTC");return formatWithMomentAs(n,i,t,a)},prepareValue:function(e,t){let a=e.data("column-type")||"";return a.startsWith("date")&&(t=this.getDateAs(e,t,"date")),t},formatComponent:function(e,t){let a=e.data("kendoDropDownList")||e.data("kendoSlider"),n=e.data("column-type")||"";n.startsWith("date")?e.val(this.getDateAs(e,t,"string")):a&&a.value(t)},compileGridListing:function(t,a){let n=t.data("ref-component");if(n&&n.tbody&&n.tbody.length&&!$(n.tbody).find(".k-grid-edit-row").length){var i=n.tbody;setTimeout(()=>{a.safeApply(()=>{var t=$(i),n=angular.element(t);e(n)(a)})})}},link:function(e,t,a){e.$watch(a.ngModel,n=>{this.isFromGrid(a)&&this.exist(t)&&this.isCompiled(t)&&(n=this.prepareValue(t,n),this.formatComponent(t,n),this.compileGridListing(t,e),call=t.data("change-grid-model"),call&&call(n))})}})]).directive("cronOrderedList",["$compile","$sce","$parse",function(e,t,a){"use strict";return{restrict:"EA",replace:!0,link:function(t,a,n,i){let o=n.attributeValue,d=n.orderedAttributeValue,r=n.listType,l=a[0].children[0].children;l=$(l);let s="",c="";$.each(l,function(e,t){c+=t.outerHTML});"numbered-list"===r?s=`<ol style="list-style-type: ${o}">${c}</ol>`:"ordered-list"===r?s=`<ul style="list-style-type: ${d}">${c}</ul>`:void 0;s=$(s),$(a).replaceWith(s),e(s)(t)}}}]).directive("crnInfiniteScroll",["$compile",function(e){"use strict";return{restrict:"EA",link:function(e,t,a){let n={isFirstTime:!0,isRunning:!1,datasource:void 0,isVisible:function(){var e=t.offset().top,a=t.offset().top+t.outerHeight(),n=$(window).scrollTop()+$(window).innerHeight(),i=$(window).scrollTop();return n>e&&i<a},loadNextPage:function(){return void 0===n.datasource&&(n.datasource=a.crnInfiniteScroll?e.$eval(a.crnInfiniteScroll):a.crnDatasource?e.$eval(a.crnDatasource):void 0),!!(n.datasource&&n.datasource.loaded&&n.datasource.loadedFinish)&&(n.datasource.nextPage(),!0)},setStopped:function(){n.isRunning=!1,n.isFirstTime&&(n.isFirstTime=!1,$(window).scroll(n.executeInfinityScroll))},executeInfinityScroll:function(){if(!n.isRunning){n.isRunning=!0;let e=0,t=setInterval(function(){n.isVisible()?n.loadNextPage()?n.isVisible()?e=0:(n.setStopped(),clearInterval(t)):5>e&&n.isVisible()?++e:(n.setStopped(),clearInterval(t)):n.setStopped()},250)}}};$(window).ready(n.executeInfinityScroll)}}}])}(app);function maskDirectiveAsDate(e,t,a){return maskDirective(e,t,a,"as-date")}function maskDirectiveMask(e,t,a){return maskDirective(e,t,a,"mask")}function maskDirective(e,t,a,n){return{restrict:"A",require:"?ngModel",link:function(i,o,d,r){function l(e,t){switch(e){case"week":return"Semana --, ----";case"month":return"-------- de ----";case"time":case"time-local":return"--:--";case"datetime-local":case"datetime":return"dd/mm/aaaa --:--";case"date":return"dd/mm/aaaa";default:let e=t;if(0<=e.indexOf("#")){let t=e.lastIndexOf("#")+1;e=t<e.length?e.substring(t):""}return e.replace(/D/g,"d").replace(/M/g,"m").replace(/Y/g,"a").replace(/H/g,"h").replace(/m/g,"m").replace(/s/g,"s").replace(/-/g,"-").replace(/:/g,":").replace(/\//g,"/")}}if("as-date"==n&&void 0!==d.mask)return;var s=a(d.ngModel),c=s.assign,p=$(o);if(p.data("alreadycompiled"))return;p.data("alreadycompiled",!0),p.data("$compile",e);var u=p.attr("type");if("email"===u){p.inputmask("email").attr("novalidate","novalidate"),p.next(".k-tooltip-validation").remove();const e=new MutationObserver(()=>{const e=p.next(".k-tooltip-validation");e.length&&e.remove()});return void e.observe(p[0].parentNode,{childList:!0,subtree:!0})}if(["week","date","time","datetime-local","month","datetime","time-local"].includes(u)){const e=["week","dat","month","datetime-local","datetime"].includes(u)?"fa fa-calendar-o":"fa fa-clock-o",t=document.createElement("span");t.className="input-icon-wrapper",t.innerHTML=`<i class="${e}" style="cursor: pointer; font-weight: 600;"></i>`;const a=document.createElement("input");a.type=u,a.style.position="absolute",a.style.opacity="0",a.style.pointerEvents="none",p.after(t),t.appendChild(a),t.addEventListener("click",()=>{a.focus()}),a.addEventListener("change",()=>{p.val(a.value),p.trigger("input")}),i.$watch(()=>p.attr("exibir-icone"),e=>{t.style.display="true"===e?"inline-block":"none"})}if(["checkbox","password","url","color","range"].includes(u))return void(["color","range"].includes(u)&&p[0].classList.remove("form-control","k-textbox"));["color","range","checkbox"].includes(u)||(p.data("type",u),p.attr("type","text")),r&&(r.$formatters=[],r.$parsers=[]);var m=d.mask||d.format||parseMaskType(u,t),g=m.replace(";1","").replace(";0","").trim();if(!g)return;let f=p.attr("placeholder");(void 0===f||0===f.length)&&(f=l(u,g));const h=f;if(p.attr("placeholder",h),["week","date","time","datetime-local","month","datetime","time-local"].includes(u)&&p.addClass("dark-placeholder"),p.on("input blur",function(){p.val()?p.attr("placeholder",""):p.attr("placeholder",h)}),["date","datetime-local","datetime","time","time-local"].includes(u)){var b={format:g,locale:t.use(),showTodayButton:!0,useStrict:!0,tooltips:{today:t.instant("DatePicker.today"),clear:t.instant("DatePicker.clear"),close:t.instant("DatePicker.close"),selectMonth:t.instant("DatePicker.selectMonth"),prevMonth:t.instant("DatePicker.prevMonth"),nextMonth:t.instant("DatePicker.nextMonth"),selectYear:t.instant("DatePicker.selectYear"),prevYear:t.instant("DatePicker.prevYear"),nextYear:t.instant("DatePicker.nextYear"),selectDecade:t.instant("DatePicker.selectDecade"),prevDecade:t.instant("DatePicker.prevDecade"),nextDecade:t.instant("DatePicker.nextDecade"),prevCentury:t.instant("DatePicker.prevCentury"),nextCentury:t.instant("DatePicker.nextCentury")}};p.datetimepicker(b)}else["number","money","integer"].includes(u)?p.inputmask("numeric",{prefix:"",rightAlign:!1}):p.mask(g);if(["date","datetime","datetime-local","month","time","week"].includes(u)){var b={format:g,locale:t.use(),showTodayButton:!0,useStrict:!0,tooltips:{today:t.instant("DatePicker.today"),clear:t.instant("DatePicker.clear"),close:t.instant("DatePicker.close"),selectMonth:t.instant("DatePicker.selectMonth"),prevMonth:t.instant("DatePicker.prevMonth"),nextMonth:t.instant("DatePicker.nextMonth"),selectYear:t.instant("DatePicker.selectYear"),prevYear:t.instant("DatePicker.prevYear"),nextYear:t.instant("DatePicker.nextYear"),selectDecade:t.instant("DatePicker.selectDecade"),prevDecade:t.instant("DatePicker.prevDecade"),nextDecade:t.instant("DatePicker.nextDecade"),prevCentury:t.instant("DatePicker.prevCentury"),nextCentury:t.instant("DatePicker.nextCentury")}};if(p.attr("from-grid")){var v=function(){var e=$(this).offset(),t=!0,a=$(this).parent().find(".bootstrap-datetimepicker-widget.dropdown-menu");if(a.length||(t=!1,a=$(this).parent().find(".bootstrap-datetimepicker-widget.dropdown-menu.top")),$(a).offset()){a.appendTo("body");var n=t?e.top+p.outerHeight():e.top-a.outerHeight();a.css({top:n,left:e.left,zIndex:999999})}};p.on("click",v),p.on("focus",function(){setTimeout(v.bind(this),100)})}if(p.datetimepicker(b),p.attr("from-grid")){var v=function(){var e=$(this).offset(),t=!0,a=$(this).parent().find(".bootstrap-datetimepicker-widget.dropdown-menu.usetwentyfour.bottom");if(a.length||(t=!1,a=$(this).parent().find(".bootstrap-datetimepicker-widget.dropdown-menu.usetwentyfour.top")),$(a).offset()){var n=$(a).offset().left,i=$("body");a.appendTo(i);var o=0;o=t?e.top+35:e.top-($(a).height()+15),a.css("top",o),a.css("bottom","auto"),a.css("left",n),a.css("z-index",999999)}};if(p.on("click",v),p.on("focus",function(){setTimeout(v.bind(this),100)}),p.on("dp.change",function(){i.safeApply(function(){var e=null;e=useUTC?moment(p.val(),g).utcOffset(window.timeZoneOffset,!0):moment(p.val(),g),("time"==u||"time-local"==u)&&(e=e.year(1970).dayOfYear(1).month(0)),e.isValid()&&r&&c(i,e.toDate())})}),p.data("initial-value")){var y=p.data("initial-value"),k=null;k=useUTC?moment(y).utcOffset(window.timeZoneOffset):moment(y),p.val(k.format(g)),p.data("initial-value",null)}}else if(p.wrap("<div style=\"position:relative\"></div>"),g&&0<g.length){function e(e){var a=Number.isInteger,n=Number.parseInt;let o="";for(let t=0;t<e.length;t++)a(n(e[t]))&&(o+=e[t]);e=o;for(let a=0;a<t.length&&a<e.length;a++)"9"!==t[a]&&t[a]!==e[a]&&(e=e.substring(0,a)+t[a]+e.substring(a));return e}p.attr("maxlength",g.length);let t=g;["D","M","Y","H","m","s"].forEach(e=>t=t.replaceAll(e,"9")),p.on("input blur",function(){let t=p.val();t&&p.val(e(t))})}p.datetimepicker(b),"true"!==d.fromGrid&&p.on("dp.change",function(){$(this).is(":visible")&&($(this).trigger("change"),i.safeApply(function(){var e=p.val(),t=null;t=useUTC?moment(e,g).utcOffset(window.timeZoneOffset,!0):moment(e,g),("time"==u||"time-local"==u)&&(t=t.year(1970).dayOfYear(1).month(0)),t.isValid()&&r&&c(i,t.toDate())}))}),r&&(r.$formatters.push(e=>e?moment(e).format(g):null),r.$parsers.push(e=>{var t=moment(e,g);return t.isValid()?t.toDate():null}),p.on("dp.change",function(){i.$apply(()=>{var e=p.val(),t=moment(e,g);t.isValid()&&r.$setViewValue(t.toDate())})}))}else if("number"==u||"money"==u||"integer"==u||"money-decimal"==u){removeMask=!0;var w=g.trim().replace(/\./g,"").replace(/\,/g,"").replace(/#/g,"").replace(/0/g,"").replace(/9/g,""),C="",S="",D="",x=",",T=0;g.startsWith(w)?C=w:g.endsWith(w)&&(S=w);var M=g.trim().replace(C,"").replace(S,"").trim();M.startsWith("#.")?D=".":M.startsWith("#,")&&(D=",");var E=null;if(-1==M.indexOf(",0")?-1!=M.indexOf(".0")&&(x=".",E=".0"):(x=",",E=",0"),null!=E){var I=M.substring(M.indexOf(E)+1);T=I.length}var F="numeric";0==T&&(F="integer"),"money-decimal"==u&&(F="currency");var A={rightAlign:["money","money-decimal"].includes(u),allowMinus:!0,prefix:C,suffix:S,radixPoint:x,digits:T,groupSeparator:D,autoGroup:!!D};p.inputmask(F,A),useInputMaskPlugin(p,r,i,c,g)}else{let e=["D","M","Y","H","m","s"],t=t=>(e.forEach(e=>t=t.replaceAll(e,"9")),t);if(g=t(g),!d.maskPlaceholder){p.mask(g);let e=m&&m.endsWith(";0");useMaskPlugin(p,r,i,c,e)}else{var b={placeholder:d.maskPlaceholder};p.inputmask(g,b),useInputMaskPlugin(p,r,i,c,g)}}}}}function useInputMaskPlugin(e,t,a,n,i){var o=$(e),d=function(){$(this).data("rawvalue",$(this).inputmask("unmaskedvalue"))};$(e).on("keydown",d).on("keyup",d),t&&(t.$formatters.push(function(e){return null!=e&&null!=e&&""!==e?format(i,e):null}),t.$parsers.push(function(e){if(e!=null&&null!=e&&""!==e){var t=o.inputmask("unmaskedvalue");if(""!==t){let e=o.data("type");return"number"==e||"money"==e||"integer"==e||"money-decimal"==e?+t.replace(",","."):t}}return null}))}function useMaskPlugin(e,t,a,n,i){var o=$(e),d=function(){i&&$(this).data("rawvalue",$(this).cleanVal())};$(e).on("keydown",d).on("keyup",d),i&&t&&(t.$formatters.push(function(e){return e?o.masked(e):null}),t.$parsers.push(function(e){return e?o.cleanVal():null}))}function parseMaskType(e,t){return"datetime"==e||"datetime-local"==e?(e=t.instant("Format.DateTime"),"Format.DateTime"==e&&(e="DD/MM/YYYY HH:mm:ss")):"date"==e?(e=t.instant("Format.Date"),"Format.Date"==e&&(e="DD/MM/YYYY")):"time"==e||"time-local"==e?(e=t.instant("Format.Hour"),"Format.Hour"==e&&(e="HH:mm:ss")):"month"==e?e="MMMM":"number"==e?(e=t.instant("Format.Decimal"),"Format.Decimal"==e&&(e="#.#00,00")):"money"==e||"money-decimal"==e?(e=t.instant("Format.Money"),"Format.Money"==e&&(e="#.#00,00")):"integer"==e?(e=t.instant("Format.Integer"),"Format.Integer"==e&&(e="#,##0.####")):"week"==e?e="dddd":"tel"==e?e="(00) 00000-0000;0":"text"==e?e="":"string"==e&&(e=""),e}function transformText(){return{restrict:"E",require:"?ngModel",link:function(e,t,a,n){var i=function(e,t){if(e){if(t!==void 0&&null!==t){if("uppercase"===e.css("text-transform"))return t.toUpperCase();if("lowercase"===e.css("text-transform"))return t.toLowerCase()}return t}};n&&(n.$formatters.push(function(e){return i(t,e)}),n.$parsers.push(function(e){return i(t,e)}))}}}app.kendoHelper={getCorrectlyDS:(e,t)=>{if(t[e]&&t[e].apiVersion)return t[e];else{let a=t.$parent[e];return t[e]=a,a}},getCorrectlyDSPromise:async(e,t)=>new Promise((a,n)=>{let i=()=>{let o=null;if(t[e]&&t[e].apiVersion)o=t[e];else{let a=t.$parent[e];t[e]=a,o=a}o?a(o):$(`datasource[name="${e}"]`).length?setTimeout(()=>i(),100):n(null)};i()}),receivePushData:e=>!e||!e.dataSource||(e.dataSource.transport.options.refComponent=e),getSchema:function(e){var t=[{kendoType:"string",entityType:["string","character","uuid","guid"]},{kendoType:"number",entityType:["integer","long","double","int","float","bigdecimal","single","int32","int64","decimal","byte"]},{kendoType:"date",entityType:["date","time","datetime"]},{kendoType:"boolean",entityType:["boolean"]}],a=function(e){for(var a=0;a<t.length;a++)if(t[a].entityType.includes(e.toLocaleLowerCase()))return t[a].kendoType;return"string"},n={model:{id:"__$id",fields:{}}};return e&&e.schemaFields&&(e.schemaFields.forEach(function(e){n.model.fields[e.name]={type:a(e.type),editable:!0,nullable:e.nullable,validation:{required:!e.nullable}}}),n.model.fields.__$id={type:"string",editable:!0,nullable:!0,validation:{required:!1}}),n},getDataSource:function(t,a,n,i,o,d){var r=Number.MAX_SAFE_INTEGER_32;function l(t){if(t.response&&t.response.d){var e=null;e=t.response.d.results?t.response.d.results:[t.response.d],this.group().length?o.forEach(function(t){if("Database"==t.dataType){var a="datetime-local"==t.type||"month"==t.type||"time-local"==t.type||"week"==t.type;if(a)for(var n,o=0;o<e.length;o++)n=e[o],t.field==n.Member&&(n.Key=n.Key.replace(/\d+/,function(e){return parseInt(e)+g})),s.bind(this)(n.Items)}}):s.bind(this)(e)}}function s(e){for(var t=0;t<e.length;t++)o&&o.forEach(function(a){if("Database"==a.dataType){var n="datetime-local"==a.type||"month"==a.type||"time-local"==a.type||"week"==a.type;n&&e[t][a.field]&&(e[t][a.field]=e[t][a.field].replace(/\d+/,function(e){return parseInt(e)+g}))}})}function c(e){var t=[];return e&&e.forEach(function(e){e.aggregates&&e.aggregates.forEach(function(a){t.push({field:e.field,aggregate:a.type})})}),t}var p=this.getSchema(t);o&&o.forEach(function(e){for(var t in p.model.fields)if("Database"==e.dataType&&e.field==t){if(p.model.fields[t].nullable=!e.required,p.model.fields[t].validation.required=e.required,"999.999.999-99;0"===e.format||"99.999.999/9999-99;0"===e.format){let a="999.999.999-99;0"===e.format?"cpf":"cnpj",n={cpf:CPF,cnpj:CNPJ},i=t.toLocaleLowerCase()+"validation";p.model.fields[t].validation[i]=function(e){return!(e.is("[name='"+t+"']")&&""!=e.val())||n[a].isValid(e.val())}}break}});var u=function(e){for(var t in e)if(p.model.fields.hasOwnProperty(t)){var a=p.model.fields[t];"string"==a.type&&null!=e[t]?e[t]+="":"number"==a.type&&null!=e[t]?e[t]=parseFloat(e[t]):"date"==a.type&&null!=e[t]?e[t]="/Date("+e[t].getTime()+")/":"boolean"==a.type&&(null==e[t]?e[t]=!1:e[t]="true"==e[t].toString().toLowerCase()),p.model.id==t&&null!=e[t]&&0==e[t].toString().length&&delete e[t]}return e},m=10;app.kendoHelper.getCorrectlyDS(t.name,a)&&(m=app.kendoHelper.getCorrectlyDS(t.name,a).rowsPerPage);var g=6e4*new Date().getTimezoneOffset(),f=app.common.generateId(),h={transport:{setActiveAndPost:function(t){var e=this.options.cronappDatasource;a.safeApply(e.updateActive(u(t.data))),e.active.__sender=f,e.postSilent(function(e){this.options.enableAndSelect(t),t.success(e),this.options.refComponent.dataSource._pristineTotal=this.options.refComponent.dataSource._pristineData.push(e)}.bind(this),function(e){this.options.enableAndSelect(t),t.error(e,e,e)}.bind(this))},pushAction:function(e,t){return a=>{let n=["read","memorydelete","overRideRefresh"];if(this.options.isComponentInDocument(this.options.refComponent)){let n=this.options.getCurrentCallbackForPush(t,this.options.refComponent),i=n[e];i?i(a):(this.options.fromRead="read"===e,this.options.cronappDatasource.reloadedFromCronapi&&(this.options.fromRead=!1,delete this.options.cronappDatasource.reloadedFromCronapi),"overRideRefresh"===e&&(this.options.refComponent.dataSource._page=1,this.options.refComponent.dataSource._skip=0),this.options.refComponent.dataSource.read())}else n.includes(e)||this.options.cronappDatasource.removeDataSourceEvents(this.options.dataSourceEventsPush)}},push:function(e){!this.options.dataSourceEventsPush&&this.options.cronappDatasource&&(this.options.dataSourceEventsPush={create:this.pushAction.bind(this)("pushUpdate",e),update:this.pushAction.bind(this)("pushUpdate",e),delete:this.pushAction.bind(this)("pushDestroy",e),overRideRefresh:this.pushAction.bind(this)("overRideRefresh",e),read:this.pushAction.bind(this)("read",e),memorycreate:this.pushAction.bind(this)("pushUpdate",e),memoryupdate:this.pushAction.bind(this)("pushUpdate",e),memorydelete:this.pushAction.bind(this)("pushDestroy",e)},"combobox"==this.origin&&delete this.options.dataSourceEventsPush.overRideRefresh,this.options.cronappDatasource.addDataSourceEvents(this.options.dataSourceEventsPush))},read:function(a){var e=!1;try{var n=this.options.cronappDatasource;this.options.kendoCallback?this.options.fromRead?this.options.kendoCallback.success(n.data):e=!0:(this.options.kendoCallback=a,e=!0)}finally{this.options.fromRead=!1}if(e){for(key in a.data)null==a.data[key]&&delete a.data[key];var i=kendo.data.transports.odata.parameterMap(a.data,"read"),o="";this.options.refComponent&&this.options.refComponent.dataSource.group().forEach(function(e){o+=e.field+" "+e.dir+","}),0<o.length&&(o=o.substr(0,o.length-1),i.$orderby=i.$orderby?o+","+i.$orderby:o);var n=this.options.cronappDatasource;if(n.rowsPerPage=a.data.pageSize,n.offset=a.data.page-1,!a.data.pageSize&&(n.rowsPerPage=r,n.offset=void 0,i.$skip=0,this.options.refComponent&&1!=this.options.refComponent.dataSource.page()))return this.options.refComponent.dataSource.page(1),void a.error("canceled","canceled","canceled");var d={params:i},l=!1;t.append&&(l=t.append);var s={};"button"===n.loadDataStrategy&&0<n.data.length&&(s.origin=n.loadDataStrategy),n.append=l,n.fetch(d,{success:function(e){a.success(e)},canceled:function(e){a.error("canceled","canceled","canceled")},error:function(e){a.error("canceled","canceled","canceled")}},l,s)}},update:function(t){this.setActiveAndPost(t)},create:function(t){this.setActiveAndPost(t)},destroy:function(t){cronappDatasource=this.options.cronappDatasource,cronappDatasource.removeSilent(t.data,function(e){t.success(e)},function(e){t.error("canceled","canceled","canceled")})},batch:function(t){},options:{fromRead:!1,disableAndSelect:function(t){this.isComponentInDocument(this.refComponent)&&(this.refComponent.select(t.container),this.refComponent.options.selectable=!1,this.refComponent.selectable&&this.refComponent.selectable.element&&(this.refComponent.selectable.destroy(),this.refComponent.selectable=null))},enableAndSelect:function(t){this.isComponentInDocument(this.refComponent)&&(this.refComponent.options.selectable=this.refComponent.options.originalSelectable,this.refComponent._selectable(),this.refComponent.select(t.container))},selectActiveInGrid:function(e){if(this.isComponentInDocument(this.refComponent)&&this.refComponent.selectable&&0<this.refComponent.dataItems().length&&this.cronappDatasource.active&&this.cronappDatasource.active.__$id){for(var t=this.refComponent.dataItems(),a=-1,n=0;n<t.length;n++)if(this.cronappDatasource.active.__$id==t[n].__$id){a=n;break}-1<a&&!this.refComponent.selectable.options.multiple&&this.refComponent.select(this.refComponent.table.find("tr")[a+1])}},isComponentInDocument:function(e){return!!e&&$(document).has(e.element[0]).length},getCurrentCallbackForPush:function(e,t){return e?e:t},cronappDatasource:app.kendoHelper.getCorrectlyDS(t.name,a)}},pageSize:m,serverPaging:!0,serverFiltering:!0,serverSorting:!0,batch:!1,schema:p,requestEnd:l};return h.aggregate=c(o),h.schema.total=function(){return h.transport.options.cronappDatasource.getRowsCount()},d&&(h.group=[],d.forEach(function(e){var t={field:e.field,aggregates:h.aggregate};h.group.push(t)})),h},getEventReadCombo:function(t){var e=this.options.cronappDatasource;if(!e)return void t.error("canceled","canceled","canceled");this.options.kendoCallback||(this.options.kendoCallback=t);var a;if(this.options.combobox&&this.options.combobox.options.readData)return t.success(this.options.combobox.options.readData),this.options.combobox.options.readData=null,void(this.options.alreadyLoaded=!0);this.options.combobox?a=!this.options.alreadyLoaded:e.__ignoreFirstFetch?(a=!0,delete e.__ignoreFirstFetch):a=!1,this.options.alreadyLoaded=!0;var n=!0;if(a&&(n=!1,e.lazy?t.success([{}]):t.success([])),(this.options.fromRead||this.options.combobox&&void 0===this.options.combobox.options.firstLazyRead)&&(this.options.fromRead=!1,this.options.kendoCallback.success(e.data),n=!1),n&&!e.busy){for(key in t.data)null==t.data[key]&&delete t.data[key];var i=kendo.data.transports.odata.parameterMap(t.data,"read");e.rowsPerPage=t.data.pageSize,e.offset=t.data.page-1;var o=this,d=!0,r={};r.params=i,o.options.combobox&&(o.options.combobox.options.fromCombo=!0),e.fetch(r,{success:function(e){if(t.success&&(o.options.combobox&&(o.options.combobox.options.expanded=!0),t.success(e),o&&o.options&&o.options.combobox&&o.options.combobox.span&&o.options.$compile(o.options.combobox.span)(o.options.scope),o.options.kendoCallback=t,o.options&&o.options.combobox&&o.options.combobox.element[0].id)){var a=" .k-animation-container",n=angular.element($(" .k-animation-container"));o.options.$compile(n)(o.options.scope)}},canceled:function(e){o.options.combobox&&(o.options.combobox.options.fromCombo=!1),t.success&&t.error("canceled","canceled","canceled")},error:function(e){o.options.combobox&&(o.options.combobox.options.fromCombo=!1),t.success&&t.error("error","error","error")}},!1,{ignoreAtive:!0})}},parseOptionsCronToConfigKendo:function(e,t,a){let n=!1;e.dynamic&&"false"!=e.dynamic?e.dataSourceScreen&&e.dataSourceScreen.entityDataSource&&(e.dataSourceScreen.entityDataSource.append=!0,t=app.kendoHelper.getDataSource(e.dataSourceScreen.entityDataSource,a,!0,e.dataSourceScreen.rowsPerPage),t.transport.read=app.kendoHelper.getEventReadCombo,n=!0):(n=!0,e.dataValueField=e.dataValueField||"value",e.dataTextField=e.dataTextField||"key"),e.dataValueField&&""!=e.dataValueField.trim()||(e.dataValueField=null==e.dataTextField?void 0:e.dataTextField);var i=function(t){var a=e.dataSourceScreen.entityDataSource.schemaFields;for(count=0;count<a.length;count++)if(t==a[count].name){return a[count].type.toLowerCase();break}return null},o=function(e){var t=["date","time","datetime"];return-1<t.indexOf(e)?e:null};!e.customTemplate&&e.dataSourceScreen&&e.dataSourceScreen.entityDataSource&&e.dataSourceScreen.entityDataSource.schemaFields&&(e.format||o(i(e.dataTextField)))&&(e.template="#= useMask("+e.dataTextField+",'"+e.format+"','"+i(e.dataTextField)+"') #",e.valueTemplate="#= useMask("+e.dataTextField+",'"+e.format+"','"+i(e.dataTextField)+"') #");var d={dataTextField:null==e.dataTextField?void 0:e.dataTextField,dataValueField:null==e.dataValueField?void 0:e.dataValueField,dataSource:t,headerTemplate:null==e.headerTemplate?void 0:e.headerTemplate,template:null==e.template?void 0:e.template,tagTemplate:null==e.tagTemplate?void 0:e.tagTemplate,placeholder:null==e.placeholder?void 0:e.placeholder,footerTemplate:null==e.footerTemplate?void 0:e.footerTemplate,filter:null==e.filter?void 0:e.filter,valuePrimitive:n,valueTemplate:null==e.valueTemplate?void 0:e.valueTemplate,suggest:!0};return e.optionLabel&&(e.optionLabelText=e.optionLabel,e.optionLabelValue=""),d.optionLabel={},d.optionLabel[d.dataTextField]=void 0===e.optionLabelText?"":e.optionLabelText,d.optionLabel[d.dataValueField]=void 0===e.optionLabelValue?null:e.optionLabelValue,d},getConfigComboboxSync:function(e,t){var a={};if(e){if(!e.dynamic||"false"==e.dynamic){a.data=null==e.staticDataSource?void 0:e.staticDataSource;for(let n=0;n<a.data.length;n++)try{a.data[n].key&&a.data[n].key.startsWith("cronapi.server(")&&(a.data[n].key=a.data[n].key.replace(".run(",".notAsync().run("));let e=t.$eval(a.data[n].key);a.data[n].key=void 0!==e&&null!==e?e:a.data[n].key}catch(t){a.data[n].key=a.data[n].key}}return config=this.parseOptionsCronToConfigKendo(e,a,t),config}return{}},getConfigCombobox:async function(e,t){var a={};if(e){if(!e.dynamic||"false"==e.dynamic){a.data=null==e.staticDataSource?void 0:e.staticDataSource;for(let n=0;n<a.data.length;n++)try{a.data[n].key&&a.data[n].key.startsWith("cronapi.server(")&&(a.data[n].key=a.data[n].key.replace(".run(",".toPromise().run("));let e=await t.$eval(a.data[n].key);a.data[n].key=void 0!==e&&null!==e?e:a.data[n].key}catch(t){a.data[n].key=a.data[n].key}}return config=this.parseOptionsCronToConfigKendo(e,a,t),config}return{}},getConfigDate:function(e,t){var a={};if(a){var n=function(e){e=e.replace(/_/gm,"-");var t=e.split("-");return t[t.length-1]=t[t.length-1].toUpperCase(),t.join("-")},i=function(e){return e&&(e=e.replace(/:MM/gm,":mm"),e=e.replace(/:M/gm,":m"),e=e.replace(/S/gm,"s"),e=e.replace(/D/gm,"d"),e=e.replace(/Y/gm,"y")),e},o=function(t,a){return null==a&&(a=parseMaskType(t,e)),a},d={};if(t.animation)try{d=JSON.parse(t.animation)}catch(e){console.log("DateAnimation invalid configuration! "+e)}var r=o(t.type,t.format),l=i(r),s=i(t.timeFormat),c=n(e.use());a={value:null,format:l,timeFormat:s,momentFormat:r,culture:c,type:null==t.type?void 0:t.type,weekNumber:null==t.weekNumber?void 0:t.weekNumber,dateInput:null==t.dateInput?void 0:t.dateInput,animation:d,footer:null==t.footer?void 0:t.footer,start:null==t.start?void 0:t.start,depth:null==t.start?void 0:t.start}}return a},buildKendoMomentPicker:function(e,t,a,n){var i="date"==t.type||"datetime"==t.type||"time"==t.type;window.fixedTimeZone||(i=!1),e.data("mask",t.momentFormat),e.data("useUTC",i);var o=function(){var a=e.val();if(!a||""==a.trim())n&&n.$setViewValue("");else{var o=formatWithMomentAs(t.momentFormat,i,a,"date");n&&(n.$setViewValue(o),e.data("changed",!0))}};return(t.change=a?function(){a.$apply(function(){o()})}:o,"date"==t.type)?e.kendoDatePicker(t).data("kendoDatePicker"):"datetime"==t.type||"datetime-local"==t.type?e.kendoDateTimePicker(t).data("kendoDateTimePicker"):"time"==t.type||"time-local"==t.type?e.kendoTimePicker(t).data("kendoTimePicker"):void 0},getConfigSlider:function(e){e=e||{};var t={increaseButtonTitle:e.increaseButtonTitle,decreaseButtonTitle:e.decreaseButtonTitle,dragHandleTitle:e.dragHandleTitle};try{t.min=e.min?parseInt(e.min):1,t.max=e.max?parseInt(e.max):1,t.smallStep=e.smallStep?parseInt(e.smallStep):1,t.largeStep=e.largeStep?parseInt(e.largeStep):1}catch(e){console.log("Slider invalid configuration! "+e)}return t},getConfigSwitch:function(e){e=e||{};var t={onLabel:null==e.onLabel?void 0:e.onLabel,offLabel:null==e.offLabel?void 0:e.offLabel};return t},getConfigBarcode:function(e){var t={type:null==e.type?void 0:e.type,width:null==e.width?void 0:parseInt(e.width),height:null==e.height?void 0:parseInt(e.height)};return t.type||(t.type="EAN8"),t},getConfigQrcode:function(e){var t={errorCorrection:null==e.errorCorrection?void 0:e.errorCorrection,size:null==e.size?void 0:parseInt(e.size),color:null==e.color?void 0:e.color};return(e.borderColor||e.borderSize)&&(t.border={size:null==e.size?void 0:parseInt(e.size),color:null==e.color?void 0:e.color}),t}},window.showTreatedValue=function(e){return e||!1===e?e:""},window.useMask=function(e,t,a){var n="";t="null"==t||"undefined"==t?void 0:t;var i=e,o=t||a;if(null!=e&&e!=null){if(e instanceof Date){var d=moment(e).utcOffset(window.timeZoneOffset);i="\""+d.format()+"\""}else i="number"==typeof e?e:"\""+e+"\"";n="{{ "+i+" | mask:\""+o+"\":\""+a+"\"}}"}return n},window.formatWithMomentAs=function(e,t,a,n){if(!a)return;let i=null;return i=a instanceof Date||a.startsWith("/Date")?t?moment(a).utcOffset(window.timeZoneOffset):moment(a):t?moment(a,e).utcOffset(window.timeZoneOffset,!0):moment(a,e),"string"===n?i.format(e):i.toDate()};function cronFrame($compile,$sce,$parse){"use strict";return{restrict:"AE",link:function(scope,element,attrs,ngModelCtrl){scope.fragment=scope.fragment||{};var framentMap=scope.fragment[element.parent.id]||{};scope.$watch(function(){return attrs.origin},function(newVal){let template="",style=attrs.style||"",clazz=attrs.class||"";if(attrs.origin)if(attrs.type||(attrs.type="include"),"include"==attrs.type){let str=`<div style="${style}" class="${clazz}" ng-include="'${attrs.origin}'" ng-if="true"></div>`;if(template=$(str),attrs.params)try{let params=eval(attrs.params);for(let e in params){let t=params[e];"expression"==t.type?scope.$watch(t.value,function(e){framentMap[t.key]=e;var a=$(str);a.attr("onload",`params = ${JSON.stringify(framentMap)}`);var n=$compile(a)(scope);element.html(n)}):framentMap[t.key]=t.value}template.attr("onload",`params = ${JSON.stringify(framentMap)}`)}catch(e){console.error(e)}}else if("frame"==attrs.type){var url=$sce.trustAsResourceUrl(attrs.origin);template=$(`<iframe style="${style}" class="${clazz}" ng-src="${url}" width="100%" height="100%" loading="lazy"></iframe>`)}element.html(template),$compile(template)(scope)})}}}function cronReportViewer(e){return{restrict:"E",replace:!0,require:"ngModel",link:function(e,t,a,n){function i(a){var n=JSON.parse(a),i={element:t};e.$eval(n.reportCommand||n.dashboardCommand,i)}i(a.options);let o=t[0].parentElement;for(;o;)if("BODY"===o.tagName)o=null;else if(o.classList.contains("tab-pane"))break;else o=o.parentElement;if(o&&!o.classList.contains("active")){let e=new MutationObserver(function(e,t){for(let n of e)if("class"===n.attributeName&&n.target.classList.contains("active")){i(a.options),t.disconnect();break}});e.observe(o,{attributes:!0})}var d=null;e.$watch(function(){return a.options},function(e,t){e!==t&&(d&&(clearInterval(d),d=null),d=setTimeout(function(){i(e)}.bind(this),500))})}}}
55
+ </li>`}),i},link:function(a,n,i){var o=this.populateMenu;i.$observe("options",function(d){t.onReady(()=>{let t=n.closest(".crn-navigator-vertical").length;var r={};try{r=JSON.parse(d)}catch(t){console.log("CronDynamicMenu: Invalid configuration!")}let l=r&&r.subMenuOptions&&r.subMenuOptions.length?r.subMenuOptions[0].id:"first";var s=`<ul id="menu-tag-ul-base-${l}" class="nav navbar-nav ${t?"col-md-12 padding-0":""}" ></ul>`,c=$(s);c.attr("id",i.id);var p=o(r,t);c.append(p),t&&c.append($("#navbar2 li:first").addClass("col-md-12 padding-0"));var u=angular.element(c);n.html(""),n.append(c),n.attr("id",null),e(u)(a);var m=i.multilevelAction;"hover"===m&&($(".dropdown-menu .dropdown-submenu").on("mouseover",function(){var e=$(this).children("ul.dropdown-menu");e.addClass("displayBlock")}),$(".dropdown-menu .dropdown-submenu").on("mouseout",function(){var e=$(this).children("ul.dropdown-menu");e.removeClass("displayBlock")})),"click"===m&&$(".dropdown-menu a.dropdown-toggle").on("click",function(t){$(this).next().hasClass("show")||$(this).parents(".dropdown-menu").first().find(".show").removeClass("show");var e=$(this).next(".dropdown-menu");return e.toggleClass("show"),$(this).parents("li.nav-item.dropdown").on("hidden.bs.dropdown",function(t){$(".dropdown-submenu .show").removeClass("show")}),!1}),$("#checkCollapsibleMenu").on("click",function(){var e=document.getElementById("main-view");this.checked?e.classList.remove("main-view-retratil"):e.classList.add("main-view-retratil")});let g=n.closest("nav");if(g&&g.length){let e=!g.hasClass("submenu-click"),t=g.attr("id");if(t||(t=app.common.generateId(),g.attr("id",t)),e){let e=$(`#${t} .dropdown-submenu`).data("hooked");e||($(`#${t} .dropdown-submenu`).on("mouseenter",function(t){$(this).children(".dropdown-menu").addClass("show")}).on("mouseleave",function(t){$(this).children(".dropdown-menu").removeClass("show")}),$(`#${t} .dropdown-submenu`).data("hooked",!0))}else{let e=$(`#${t} .dropdown-menu a.dropdown-toggle`).data("hooked");e||($(`#${t} .dropdown-menu a.dropdown-toggle`).on("click",function(t){$(this).next().hasClass("show")||$(this).parents(".dropdown-menu").first().find(".show").removeClass("show");var e=$(this).next(".dropdown-menu");return e.toggleClass("show"),$(this).parents("li.nav-item.dropdown.show").on("hidden.bs.dropdown",function(t){$(".dropdown-submenu .show").removeClass("show")}),!e.length&&void $(".dropdown-menu").removeClass("show")}),$(`#${t} .dropdown-menu a.dropdown-toggle`).data("hooked",!0));let a=$(`#${t} .dropdown.nav-item`).data("hooked");a||($(`#${t} .dropdown.nav-item`).on("hidden.bs.dropdown",function(t){$(".dropdown-submenu .show").removeClass("show"),$(".dropdown-menu .show").removeClass("show")}),$(`#${t} .dropdown.nav-item`).data("hooked",!0))}}else{let e=$(n).find("ul:first").attr("id"),t=$(`#${e} .dropdown-submenu`).data("hooked");t||($(`#${e} .dropdown-submenu`).on("mouseenter",function(t){$(this).children(".dropdown-menu").addClass("show")}).on("mouseleave",function(t){$(this).children(".dropdown-menu").removeClass("show")}),$(`#${e} .dropdown-submenu`).data("hooked",!0))}})})}}}]).directive("cronBreadcrumbs",["$rootScope",function(e){"use strict";return{restrict:"E",replace:!0,link:function(e,t,a){let n=a.ngInit?a.ngInit:null,i=[];const o=a.crnDelimiterIcon,d=a.typeMenu,r=a.idMenu?a.idMenu:null,l=a.id,s=a.breadcrumbIcon?a.breadcrumbIcon:null,c=()=>{const e=$(`#${l}`);e.data("kendoBreadcrumb")&&(e.data("kendoBreadcrumb").destroy(),e.empty())},p=async()=>{const t=n.replace("cronapi.client('js.","blockly.js.");n=t.replace("').run()",""),n=e.$eval(n),i=await n();const a=async t=>{t.item.action&&t.item.action()};c(),$(`#${l}`).kendoBreadcrumb({items:i,delimiterIcon:o,navigational:!0,click:a})},u=e=>e?e.replace("cronapi.screen.changeView('","").replace("', [])",""):"#/home";if(n&&"idBloco"===d)p();else{var m=new MutationObserver((e,t)=>{const a=$(`#${r}`).parent(),n=a.attr("options");if(n){t.disconnect();const e=JSON.parse(n),a=document.location.hash||"home",r=(e,t,a=[])=>{for(let o=0;o<e.length;o++){var n=e[o];if(n.action=u(n.action),n.action===t)return[...a,n];if(n.menuItems){const e=r(n.menuItems,t,[...a,n]);if(e)return e}}return null},s=r(e.subMenuOptions,a);if(s){for(var d in i=[],s){const e=s[d];i.push({type:0==d?"rootitem":"item",href:e.action,text:e.title,showText:!0,showIcon:!1})}c(),$(`#${l}`).kendoBreadcrumb({items:i,delimiterIcon:o,navigational:!0})}}});m.observe(document.body,{childList:!0,attributes:!0,subtree:!0})}}}}]).directive("ngInitialValue",["$parse",function(e){return{restrict:"A",require:"ngModel",link:async function(t,a,n,i){if(n.ngInitialValue){var o,d=e(n.ngModel),r=d.assign;try{if(-1!=n.ngInitialValue.indexOf("cronapi.client('js.")){let e=n.ngInitialValue.replace("cronapi.client('js.","blockly.js."),a=e.split("').names")[0];a=a.split("').attr()")[0];let i=e.split(".run")[1];o=await t.$eval(a+i)}else o=t.$eval(n.ngInitialValue)||n.ngInitialValue}catch(t){o=n.ngInitialValue}"checkbox"==a[0].type&&o&&(o="true"==(""+o).toLowerCase()),r(t,o)}}}}]).directive("crnSetIndeterminate",["$parse",function($parse){return{restrict:"A",link:function(scope,element,attrs){let value=eval(attrs.crnSetIndeterminate);null===value&&$(element).prop("indeterminate",!0)}}}]).directive("crnAllowNullValues",[function(){return{restrict:"A",require:"?ngModel",link:function(e,t,a,n){n.$formatters=[],n.$parsers=[];let i=e=>(e&&-1===e.indexOf("'")&&(e=`'${e}'`),e);a.ngFalseValue=i(a.ngFalseValue),a.ngTrueValue=i(a.ngTrueValue);let o=!!a.ngFalseValue&&a.ngFalseValue.split("'").join(""),d=!a.ngTrueValue||a.ngTrueValue.split("'").join(""),r=e=>"true"===e||void 0===e||null===e||0==e.length;n.$render=r(a.crnAllowNullValues)?function(){let e=n.$viewValue;t.data("checked",e),!0===e||e===d?(t.prop("indeterminate",!1),t.prop("checked",!0),e=d):!1===e||e===o?(t.prop("indeterminate",!1),t.prop("checked",!1),e=o):(e=null,t.prop("indeterminate",!0)),setTimeout(()=>n.$setViewValue(e))}:function(){let i=n.$viewValue;if((void 0===n.$viewValue||null===n.$viewValue)&&(n.$setViewValue(!1),i=!1),i===o){let n=a.ngFalseValue?`${t.attr("ng-model")}=${a.ngFalseValue}`:`${t.attr("ng-model")}=${o}`;e.$eval(n)}switch(t.data("checked",i),i){case!0:case d:t.prop("indeterminate",!1),t.prop("checked",!0),i=d;break;default:t.prop("indeterminate",!1),t.prop("checked",!1),i=o}setTimeout(()=>n.$setViewValue(i))},t.bind("click",function(){let i;switch(t.data("checked")){case!1:case o:i=!a.ngTrueValue||d;break;default:i=!!a.ngFalseValue&&o}n.$setViewValue(i),e.$apply(n.$render)})}}}]).directive("signaturePad",["$compile","$window",function(e,t){"use strict";var a,n,i=null;return{restrict:"E",require:"ngModel",scope:!0,replace:!0,transclude:!0,template:"<div style=\"height: 100%; width: 100%;\"> <canvas style=\"width:100%; height: 100%;\" ng-click=\"mouseup()\" ng-mouseup=\"mouseup()\"></canvas> <div class=\"component-holder ng-scope col-md-2\" style=\"bottom: 0; position: absolute; padding-left: 5px;\" data-component=\"crn-button\"> <button class=\"btn k-button btn-warning\" ng-click=\"clear()\" xattr-fullsize=\"\" xattr-theme=\"btn-warning\" xattr-disabled=\"\"> <i class=\"glyphicon glyphicon-erase\" icon-theme=\"\"></i> <span class=\"\" text-theme=\"\">{{'clear'|translate}}</span> </button> </div> </div>",scope:{dataurl:"=",ngClick:"@",ngModel:"="},controller:["$scope",function(t){let a=()=>{let e=t.signaturePad.toDataURL();return e&&(e=e.split(",")[1]),e};t.mouseup=function(n){t.signaturePad.isEmpty()||(t.ngModel=a())},t.$watch("ngModel",function(e,n){e!==n&&(a()!==e&&t.signaturePad.fromDataURL("data:image/png;base64,"+e,{ratio:1}),t.ngModel=e)},!0),t.clear=function(){t.signaturePad.clear(),t.ngModel=null}}],link:function(n,i,o,d,r){a=i.find("canvas")[0],n.onResize=function(){var e=Math.max(t.devicePixelRatio||1,1),a=i.find("canvas")[0],n=document.createElement("canvas");n.width=a.width,n.height=a.height;var o=n.getContext("2d");o.drawImage(a,0,0),a.width=a.offsetWidth*e,a.height=a.offsetHeight*e,a.getContext("2d").drawImage(n,0,0),a.getContext("2d").scale(e,e)},n.onResize(),n.signaturePad=new SignaturePad(a),angular.element(t).on("resize",function(){n.onResize()}),e(i)(i.scope());let l=!1;$(a).on("pointerdown",t=>{1===t.which&&(l=!0),t.preventDefault()}),$(a).on("pointerup",t=>{1===t.which&&l&&(l=!1,r(()=>angular.element(a).triggerHandler("mouseup")))})}}}]).directive("cronChat",["$compile","$translate",function(e,t){return{restrict:"E",replace:!0,link:function(e,t,a,n){var i=JSON.parse(a.options||"{}");if(i.token&&i.urlCronchat){var o=i.urlCronchat.endsWith("/")?i.urlCronchat:i.urlCronchat+"/",d=i.token,r=$(`<script src="${o}get-chat?token=${d}" type="text/javascript"></script>`);t.html(r)}}}}]).directive("updateLanguage",["$rootScope",function(e){return{link:function(t,a){var n=function(e,t){var n="en",i=t.language;"pt_br"===i?i="pt-br":i.startsWith("en")&&(i="en"),a.attr("lang",i||"en")};e.$on("$translateChangeSuccess",n)}}}]).directive("cronFrame",cronFrame).directive("crnComponent",cronFrame).directive("fromGrid",["$compile",e=>({restrict:"A",priority:-999999,exist:e=>{let t=e.attr("id");return $(`#${t}`).length},isFromGrid:e=>"true"===e.fromGrid,isCompiled:e=>e.data("alreadycompiled"),getDateAs:function(e,t,a){let n=e.data("mask"),i=e.data("useUTC");return formatWithMomentAs(n,i,t,a)},prepareValue:function(e,t){let a=e.data("column-type")||"";return a.startsWith("date")&&(t=this.getDateAs(e,t,"date")),t},formatComponent:function(e,t){let a=e.data("kendoDropDownList")||e.data("kendoSlider"),n=e.data("column-type")||"";n.startsWith("date")?e.val(this.getDateAs(e,t,"string")):a&&a.value(t)},compileGridListing:function(t,a){let n=t.data("ref-component");if(n&&n.tbody&&n.tbody.length&&!$(n.tbody).find(".k-grid-edit-row").length){var i=n.tbody;setTimeout(()=>{a.safeApply(()=>{var t=$(i),n=angular.element(t);e(n)(a)})})}},link:function(e,t,a){e.$watch(a.ngModel,n=>{this.isFromGrid(a)&&this.exist(t)&&this.isCompiled(t)&&(n=this.prepareValue(t,n),this.formatComponent(t,n),this.compileGridListing(t,e),call=t.data("change-grid-model"),call&&call(n))})}})]).directive("cronOrderedList",["$compile","$sce","$parse",function(e,t,a){"use strict";return{restrict:"EA",replace:!0,link:function(t,a,n,i){let o=n.attributeValue,d=n.orderedAttributeValue,r=n.listType,l=a[0].children[0].children;l=$(l);let s="",c="";$.each(l,function(e,t){c+=t.outerHTML});"numbered-list"===r?s=`<ol style="list-style-type: ${o}">${c}</ol>`:"ordered-list"===r?s=`<ul style="list-style-type: ${d}">${c}</ul>`:void 0;s=$(s),$(a).replaceWith(s),e(s)(t)}}}]).directive("crnInfiniteScroll",["$compile",function(e){"use strict";return{restrict:"EA",link:function(e,t,a){let n={isFirstTime:!0,isRunning:!1,datasource:void 0,isVisible:function(){var e=t.offset().top,a=t.offset().top+t.outerHeight(),n=$(window).scrollTop()+$(window).innerHeight(),i=$(window).scrollTop();return n>e&&i<a},loadNextPage:function(){return void 0===n.datasource&&(n.datasource=a.crnInfiniteScroll?e.$eval(a.crnInfiniteScroll):a.crnDatasource?e.$eval(a.crnDatasource):void 0),!!(n.datasource&&n.datasource.loaded&&n.datasource.loadedFinish)&&(n.datasource.nextPage(),!0)},setStopped:function(){n.isRunning=!1,n.isFirstTime&&(n.isFirstTime=!1,$(window).scroll(n.executeInfinityScroll))},executeInfinityScroll:function(){if(!n.isRunning){n.isRunning=!0;let e=0,t=setInterval(function(){n.isVisible()?n.loadNextPage()?n.isVisible()?e=0:(n.setStopped(),clearInterval(t)):5>e&&n.isVisible()?++e:(n.setStopped(),clearInterval(t)):n.setStopped()},250)}}};$(window).ready(n.executeInfinityScroll)}}}])}(app);function maskDirectiveAsDate(e,t,a){return maskDirective(e,t,a,"as-date")}function maskDirectiveMask(e,t,a){return maskDirective(e,t,a,"mask")}function maskDirective(e,t,a,n){return{restrict:"A",require:"?ngModel",link:function(i,o,d,r){function l(e,t){switch(e){case"week":return"Semana --, ----";case"month":return"-------- de ----";case"time":case"time-local":return"--:--";case"datetime-local":case"datetime":return"dd/mm/aaaa --:--";case"date":return"dd/mm/aaaa";default:let e=t;if(0<=e.indexOf("#")){let t=e.lastIndexOf("#")+1;e=t<e.length?e.substring(t):""}return e.replace(/D/g,"d").replace(/M/g,"m").replace(/Y/g,"a").replace(/H/g,"h").replace(/m/g,"m").replace(/s/g,"s").replace(/-/g,"-").replace(/:/g,":").replace(/\//g,"/")}}if("as-date"==n&&void 0!==d.mask)return;var s=a(d.ngModel),c=s.assign,p=$(o);if(p.data("alreadycompiled"))return;p.data("alreadycompiled",!0),p.data("$compile",e);var u=p.attr("type");if("email"===u){p.inputmask("email").attr("novalidate","novalidate"),p.next(".k-tooltip-validation").remove();const e=new MutationObserver(()=>{const e=p.next(".k-tooltip-validation");e.length&&e.remove()});return void e.observe(p[0].parentNode,{childList:!0,subtree:!0})}if(["week","date","time","datetime-local","month","datetime","time-local"].includes(u)){const e=["week","dat","month","datetime-local","datetime"].includes(u)?"fa fa-calendar-o":"fa fa-clock-o",t=document.createElement("span");t.className="input-icon-wrapper",t.innerHTML=`<i class="${e}" style="cursor: pointer; font-weight: 600;"></i>`;const a=document.createElement("input");a.type=u,a.style.position="absolute",a.style.opacity="0",a.style.pointerEvents="none",p.after(t),t.appendChild(a),t.addEventListener("click",()=>{a.focus()}),a.addEventListener("change",()=>{p.val(a.value),p.trigger("input")}),i.$watch(()=>p.attr("exibir-icone"),e=>{t.style.display="true"===e?"inline-block":"none"})}if(["checkbox","password","url","color","range"].includes(u))return void(["color","range"].includes(u)&&p[0].classList.remove("form-control","k-textbox"));["color","range","checkbox"].includes(u)||(p.data("type",u),p.attr("type","text")),r&&(r.$formatters=[],r.$parsers=[]);var m=d.mask||d.format||parseMaskType(u,t),g=m.replace(";1","").replace(";0","").trim();if(!g)return;let f=p.attr("placeholder");(void 0===f||0===f.length)&&(f=l(u,g));const h=f;if(p.attr("placeholder",h),["week","date","time","datetime-local","month","datetime","time-local"].includes(u)&&p.addClass("dark-placeholder"),p.on("input blur",function(){p.val()?p.attr("placeholder",""):p.attr("placeholder",h)}),["date","datetime-local","datetime","time","time-local"].includes(u)){var b={format:g,locale:t.use(),showTodayButton:!0,useStrict:!0,tooltips:{today:t.instant("DatePicker.today"),clear:t.instant("DatePicker.clear"),close:t.instant("DatePicker.close"),selectMonth:t.instant("DatePicker.selectMonth"),prevMonth:t.instant("DatePicker.prevMonth"),nextMonth:t.instant("DatePicker.nextMonth"),selectYear:t.instant("DatePicker.selectYear"),prevYear:t.instant("DatePicker.prevYear"),nextYear:t.instant("DatePicker.nextYear"),selectDecade:t.instant("DatePicker.selectDecade"),prevDecade:t.instant("DatePicker.prevDecade"),nextDecade:t.instant("DatePicker.nextDecade"),prevCentury:t.instant("DatePicker.prevCentury"),nextCentury:t.instant("DatePicker.nextCentury")}};p.datetimepicker(b)}else["number","money","integer"].includes(u)?p.inputmask("numeric",{prefix:"",rightAlign:!1}):p.mask(g);if(["date","datetime","datetime-local","month","time","week"].includes(u)){var b={format:g,locale:t.use(),showTodayButton:!0,useStrict:!0,tooltips:{today:t.instant("DatePicker.today"),clear:t.instant("DatePicker.clear"),close:t.instant("DatePicker.close"),selectMonth:t.instant("DatePicker.selectMonth"),prevMonth:t.instant("DatePicker.prevMonth"),nextMonth:t.instant("DatePicker.nextMonth"),selectYear:t.instant("DatePicker.selectYear"),prevYear:t.instant("DatePicker.prevYear"),nextYear:t.instant("DatePicker.nextYear"),selectDecade:t.instant("DatePicker.selectDecade"),prevDecade:t.instant("DatePicker.prevDecade"),nextDecade:t.instant("DatePicker.nextDecade"),prevCentury:t.instant("DatePicker.prevCentury"),nextCentury:t.instant("DatePicker.nextCentury")}};if(p.attr("from-grid")){var v=function(){var e=$(this).offset(),t=!0,a=$(this).parent().find(".bootstrap-datetimepicker-widget.dropdown-menu");if(a.length||(t=!1,a=$(this).parent().find(".bootstrap-datetimepicker-widget.dropdown-menu.top")),$(a).offset()){a.appendTo("body");var n=t?e.top+p.outerHeight():e.top-a.outerHeight();a.css({top:n,left:e.left,zIndex:999999})}};p.on("click",v),p.on("focus",function(){setTimeout(v.bind(this),100)})}if(p.datetimepicker(b),p.attr("from-grid")){var v=function(){var e=$(this).offset(),t=!0,a=$(this).parent().find(".bootstrap-datetimepicker-widget.dropdown-menu.usetwentyfour.bottom");if(a.length||(t=!1,a=$(this).parent().find(".bootstrap-datetimepicker-widget.dropdown-menu.usetwentyfour.top")),$(a).offset()){var n=$(a).offset().left,i=$("body");a.appendTo(i);var o=0;o=t?e.top+35:e.top-($(a).height()+15),a.css("top",o),a.css("bottom","auto"),a.css("left",n),a.css("z-index",999999)}};if(p.on("click",v),p.on("focus",function(){setTimeout(v.bind(this),100)}),p.on("dp.change",function(){i.safeApply(function(){var e=null;e=useUTC?moment(p.val(),g).utcOffset(window.timeZoneOffset,!0):moment(p.val(),g),("time"==u||"time-local"==u)&&(e=e.year(1970).dayOfYear(1).month(0)),e.isValid()&&r&&c(i,e.toDate())})}),p.data("initial-value")){var y=p.data("initial-value"),k=null;k=useUTC?moment(y).utcOffset(window.timeZoneOffset):moment(y),p.val(k.format(g)),p.data("initial-value",null)}}else if(p.wrap("<div style=\"position:relative\"></div>"),g&&0<g.length){function e(e){var a=Number.isInteger,n=Number.parseInt;let o="";for(let t=0;t<e.length;t++)a(n(e[t]))&&(o+=e[t]);e=o;for(let a=0;a<t.length&&a<e.length;a++)"9"!==t[a]&&t[a]!==e[a]&&(e=e.substring(0,a)+t[a]+e.substring(a));return e}p.attr("maxlength",g.length);let t=g;["D","M","Y","H","m","s"].forEach(e=>t=t.replaceAll(e,"9")),p.on("input blur",function(){let t=p.val();t&&p.val(e(t))})}p.datetimepicker(b),"true"!==d.fromGrid&&p.on("dp.change",function(){$(this).is(":visible")&&($(this).trigger("change"),i.safeApply(function(){var e=p.val(),t=null;t=useUTC?moment(e,g).utcOffset(window.timeZoneOffset,!0):moment(e,g),("time"==u||"time-local"==u)&&(t=t.year(1970).dayOfYear(1).month(0)),t.isValid()&&r&&c(i,t.toDate())}))}),r&&(r.$formatters.push(e=>e?moment(e).format(g):null),r.$parsers.push(e=>{var t=moment(e,g);return t.isValid()?t.toDate():null}),p.on("dp.change",function(){i.$apply(()=>{var e=p.val(),t=moment(e,g);t.isValid()&&r.$setViewValue(t.toDate())})}))}else if("number"==u||"money"==u||"integer"==u||"money-decimal"==u){removeMask=!0;var w=g.trim().replace(/\./g,"").replace(/\,/g,"").replace(/#/g,"").replace(/0/g,"").replace(/9/g,""),C="",S="",D="",x=",",T=0;g.startsWith(w)?C=w:g.endsWith(w)&&(S=w);var M=g.trim().replace(C,"").replace(S,"").trim();M.startsWith("#.")?D=".":M.startsWith("#,")&&(D=",");var E=null;if(-1==M.indexOf(",0")?-1!=M.indexOf(".0")&&(x=".",E=".0"):(x=",",E=",0"),null!=E){var I=M.substring(M.indexOf(E)+1);T=I.length}var F="numeric";0==T&&(F="integer"),"money-decimal"==u&&(F="currency");var A={rightAlign:["money","money-decimal"].includes(u),allowMinus:!0,prefix:C,suffix:S,radixPoint:x,digits:T,groupSeparator:D,autoGroup:!!D};p.inputmask(F,A),useInputMaskPlugin(p,r,i,c,g)}else{let e=["D","M","Y","H","m","s"],t=t=>(e.forEach(e=>t=t.replaceAll(e,"9")),t);if(g=t(g),!d.maskPlaceholder){p.mask(g);let e=m&&m.endsWith(";0");useMaskPlugin(p,r,i,c,e)}else{var b={placeholder:d.maskPlaceholder};p.inputmask(g,b),useInputMaskPlugin(p,r,i,c,g)}}}}}function useInputMaskPlugin(e,t,a,n,i){var o=$(e),d=function(){$(this).data("rawvalue",$(this).inputmask("unmaskedvalue"))};$(e).on("keydown",d).on("keyup",d),t&&(t.$formatters.push(function(e){return null!=e&&null!=e&&""!==e?format(i,e):null}),t.$parsers.push(function(e){if(e!=null&&null!=e&&""!==e){var t=o.inputmask("unmaskedvalue");if(""!==t){let e=o.data("type");return"number"==e||"money"==e||"integer"==e||"money-decimal"==e?+t.replace(",","."):t}}return null}))}function useMaskPlugin(e,t,a,n,i){var o=$(e),d=function(){i&&$(this).data("rawvalue",$(this).cleanVal())};$(e).on("keydown",d).on("keyup",d),i&&t&&(t.$formatters.push(function(e){return e?o.masked(e):null}),t.$parsers.push(function(e){return e?o.cleanVal():null}))}function parseMaskType(e,t){return"datetime"==e||"datetime-local"==e?(e=t.instant("Format.DateTime"),"Format.DateTime"==e&&(e="DD/MM/YYYY HH:mm:ss")):"date"==e?(e=t.instant("Format.Date"),"Format.Date"==e&&(e="DD/MM/YYYY")):"time"==e||"time-local"==e?(e=t.instant("Format.Hour"),"Format.Hour"==e&&(e="HH:mm:ss")):"month"==e?e="MMMM":"number"==e?(e=t.instant("Format.Decimal"),"Format.Decimal"==e&&(e="#.#00,00")):"money"==e||"money-decimal"==e?(e=t.instant("Format.Money"),"Format.Money"==e&&(e="#.#00,00")):"integer"==e?(e=t.instant("Format.Integer"),"Format.Integer"==e&&(e="#,##0.####")):"week"==e?e="dddd":"tel"==e?e="(00) 00000-0000;0":"text"==e?e="":"string"==e&&(e=""),e}function transformText(){return{restrict:"E",require:"?ngModel",link:function(e,t,a,n){var i=function(e,t){if(e){if(t!==void 0&&null!==t){if("uppercase"===e.css("text-transform"))return t.toUpperCase();if("lowercase"===e.css("text-transform"))return t.toLowerCase()}return t}};n&&(n.$formatters.push(function(e){return i(t,e)}),n.$parsers.push(function(e){return i(t,e)}))}}}app.kendoHelper={getCorrectlyDS:(e,t)=>{if(t[e]&&t[e].apiVersion)return t[e];else{let a=t.$parent[e];return t[e]=a,a}},getCorrectlyDSPromise:async(e,t)=>new Promise((a,n)=>{let i=()=>{let o=null;if(t[e]&&t[e].apiVersion)o=t[e];else{let a=t.$parent[e];t[e]=a,o=a}o?a(o):$(`datasource[name="${e}"]`).length?setTimeout(()=>i(),100):n(null)};i()}),receivePushData:e=>!e||!e.dataSource||(e.dataSource.transport.options.refComponent=e),getSchema:function(e){var t=[{kendoType:"string",entityType:["string","character","uuid","guid"]},{kendoType:"number",entityType:["integer","long","double","int","float","bigdecimal","single","int32","int64","decimal","byte"]},{kendoType:"date",entityType:["date","time","datetime"]},{kendoType:"boolean",entityType:["boolean"]}],a=function(e){for(var a=0;a<t.length;a++)if(t[a].entityType.includes(e.toLocaleLowerCase()))return t[a].kendoType;return"string"},n={model:{id:"__$id",fields:{}}};return e&&e.schemaFields&&(e.schemaFields.forEach(function(e){n.model.fields[e.name]={type:a(e.type),editable:!0,nullable:e.nullable,validation:{required:!e.nullable}}}),n.model.fields.__$id={type:"string",editable:!0,nullable:!0,validation:{required:!1}}),n},getDataSource:function(t,a,n,i,o,d){var r=Number.MAX_SAFE_INTEGER_32;function l(t){if(t.response&&t.response.d){var e=null;e=t.response.d.results?t.response.d.results:[t.response.d],this.group().length?o.forEach(function(t){if("Database"==t.dataType){var a="datetime-local"==t.type||"month"==t.type||"time-local"==t.type||"week"==t.type;if(a)for(var n,o=0;o<e.length;o++)n=e[o],t.field==n.Member&&(n.Key=n.Key.replace(/\d+/,function(e){return parseInt(e)+g})),s.bind(this)(n.Items)}}):s.bind(this)(e)}}function s(e){for(var t=0;t<e.length;t++)o&&o.forEach(function(a){if("Database"==a.dataType){var n="datetime-local"==a.type||"month"==a.type||"time-local"==a.type||"week"==a.type;n&&e[t][a.field]&&(e[t][a.field]=e[t][a.field].replace(/\d+/,function(e){return parseInt(e)+g}))}})}function c(e){var t=[];return e&&e.forEach(function(e){e.aggregates&&e.aggregates.forEach(function(a){t.push({field:e.field,aggregate:a.type})})}),t}var p=this.getSchema(t);o&&o.forEach(function(e){for(var t in p.model.fields)if("Database"==e.dataType&&e.field==t){if(p.model.fields[t].nullable=!e.required,p.model.fields[t].validation.required=e.required,"999.999.999-99;0"===e.format||"99.999.999/9999-99;0"===e.format){let a="999.999.999-99;0"===e.format?"cpf":"cnpj",n={cpf:CPF,cnpj:CNPJ},i=t.toLocaleLowerCase()+"validation";p.model.fields[t].validation[i]=function(e){return!(e.is("[name='"+t+"']")&&""!=e.val())||n[a].isValid(e.val())}}break}});var u=function(e){for(var t in e)if(p.model.fields.hasOwnProperty(t)){var a=p.model.fields[t];"string"==a.type&&null!=e[t]?e[t]+="":"number"==a.type&&null!=e[t]?e[t]=parseFloat(e[t]):"date"==a.type&&null!=e[t]?e[t]="/Date("+e[t].getTime()+")/":"boolean"==a.type&&(null==e[t]?e[t]=!1:e[t]="true"==e[t].toString().toLowerCase()),p.model.id==t&&null!=e[t]&&0==e[t].toString().length&&delete e[t]}return e},m=10;app.kendoHelper.getCorrectlyDS(t.name,a)&&(m=app.kendoHelper.getCorrectlyDS(t.name,a).rowsPerPage);var g=6e4*new Date().getTimezoneOffset(),f=app.common.generateId(),h={transport:{setActiveAndPost:function(t){var e=this.options.cronappDatasource;a.safeApply(e.updateActive(u(t.data))),e.active.__sender=f,e.postSilent(function(e){this.options.enableAndSelect(t),t.success(e),this.options.refComponent.dataSource._pristineTotal=this.options.refComponent.dataSource._pristineData.push(e)}.bind(this),function(e){this.options.enableAndSelect(t),t.error(e,e,e)}.bind(this))},pushAction:function(e,t){return a=>{let n=["read","memorydelete","overRideRefresh"];if(this.options.isComponentInDocument(this.options.refComponent)){let n=this.options.getCurrentCallbackForPush(t,this.options.refComponent),i=n[e];i?i(a):(this.options.fromRead="read"===e,this.options.cronappDatasource.reloadedFromCronapi&&(this.options.fromRead=!1,delete this.options.cronappDatasource.reloadedFromCronapi),"overRideRefresh"===e&&(this.options.refComponent.dataSource._page=1,this.options.refComponent.dataSource._skip=0),this.options.refComponent.dataSource.read())}else n.includes(e)||this.options.cronappDatasource.removeDataSourceEvents(this.options.dataSourceEventsPush)}},push:function(e){!this.options.dataSourceEventsPush&&this.options.cronappDatasource&&(this.options.dataSourceEventsPush={create:this.pushAction.bind(this)("pushUpdate",e),update:this.pushAction.bind(this)("pushUpdate",e),delete:this.pushAction.bind(this)("pushDestroy",e),overRideRefresh:this.pushAction.bind(this)("overRideRefresh",e),read:this.pushAction.bind(this)("read",e),memorycreate:this.pushAction.bind(this)("pushUpdate",e),memoryupdate:this.pushAction.bind(this)("pushUpdate",e),memorydelete:this.pushAction.bind(this)("pushDestroy",e)},"combobox"==this.origin&&delete this.options.dataSourceEventsPush.overRideRefresh,this.options.cronappDatasource.addDataSourceEvents(this.options.dataSourceEventsPush))},read:function(a){var e=!1;try{var n=this.options.cronappDatasource;this.options.kendoCallback?this.options.fromRead?this.options.kendoCallback.success(n.data):e=!0:(this.options.kendoCallback=a,e=!0)}finally{this.options.fromRead=!1}if(e){for(key in a.data)null==a.data[key]&&delete a.data[key];var i=kendo.data.transports.odata.parameterMap(a.data,"read"),o="";this.options.refComponent&&this.options.refComponent.dataSource.group().forEach(function(e){o+=e.field+" "+e.dir+","}),0<o.length&&(o=o.substr(0,o.length-1),i.$orderby=i.$orderby?o+","+i.$orderby:o);var n=this.options.cronappDatasource;if(n.rowsPerPage=a.data.pageSize,n.offset=a.data.page-1,!a.data.pageSize&&(n.rowsPerPage=r,n.offset=void 0,i.$skip=0,this.options.refComponent&&1!=this.options.refComponent.dataSource.page()))return this.options.refComponent.dataSource.page(1),void a.error("canceled","canceled","canceled");var d={params:i},l=!1;t.append&&(l=t.append);var s={};"button"===n.loadDataStrategy&&0<n.data.length&&(s.origin=n.loadDataStrategy),n.append=l,n.fetch(d,{success:function(e){a.success(e)},canceled:function(e){a.error("canceled","canceled","canceled")},error:function(e){a.error("canceled","canceled","canceled")}},l,s)}},update:function(t){this.setActiveAndPost(t)},create:function(t){this.setActiveAndPost(t)},destroy:function(t){cronappDatasource=this.options.cronappDatasource,cronappDatasource.removeSilent(t.data,function(e){t.success(e)},function(e){t.error("canceled","canceled","canceled")})},batch:function(t){},options:{fromRead:!1,disableAndSelect:function(t){this.isComponentInDocument(this.refComponent)&&(this.refComponent.select(t.container),this.refComponent.options.selectable=!1,this.refComponent.selectable&&this.refComponent.selectable.element&&(this.refComponent.selectable.destroy(),this.refComponent.selectable=null))},enableAndSelect:function(t){this.isComponentInDocument(this.refComponent)&&(this.refComponent.options.selectable=this.refComponent.options.originalSelectable,this.refComponent._selectable(),this.refComponent.select(t.container))},selectActiveInGrid:function(e){if(this.isComponentInDocument(this.refComponent)&&this.refComponent.selectable&&0<this.refComponent.dataItems().length&&this.cronappDatasource.active&&this.cronappDatasource.active.__$id){for(var t=this.refComponent.dataItems(),a=-1,n=0;n<t.length;n++)if(this.cronappDatasource.active.__$id==t[n].__$id){a=n;break}-1<a&&!this.refComponent.selectable.options.multiple&&this.refComponent.select(this.refComponent.table.find("tr")[a+1])}},isComponentInDocument:function(e){return!!e&&$(document).has(e.element[0]).length},getCurrentCallbackForPush:function(e,t){return e?e:t},cronappDatasource:app.kendoHelper.getCorrectlyDS(t.name,a)}},pageSize:m,serverPaging:!0,serverFiltering:!0,serverSorting:!0,batch:!1,schema:p,requestEnd:l};return h.aggregate=c(o),h.schema.total=function(){return h.transport.options.cronappDatasource.getRowsCount()},d&&(h.group=[],d.forEach(function(e){var t={field:e.field,aggregates:h.aggregate};h.group.push(t)})),h},getEventReadCombo:function(t){var e=this.options.cronappDatasource;if(!e)return void t.error("canceled","canceled","canceled");this.options.kendoCallback||(this.options.kendoCallback=t);var a;if(this.options.combobox&&this.options.combobox.options.readData)return t.success(this.options.combobox.options.readData),this.options.combobox.options.readData=null,void(this.options.alreadyLoaded=!0);this.options.combobox?a=!this.options.alreadyLoaded:e.__ignoreFirstFetch?(a=!0,delete e.__ignoreFirstFetch):a=!1,this.options.alreadyLoaded=!0;var n=!0;if(a&&(n=!1,e.lazy?t.success([{}]):t.success([])),(this.options.fromRead||this.options.combobox&&void 0===this.options.combobox.options.firstLazyRead)&&(this.options.fromRead=!1,this.options.kendoCallback.success(e.data),n=!1),n&&!e.busy){for(key in t.data)null==t.data[key]&&delete t.data[key];var i=kendo.data.transports.odata.parameterMap(t.data,"read");e.rowsPerPage=t.data.pageSize,e.offset=t.data.page-1;var o=this,d=!0,r={};r.params=i,o.options.combobox&&(o.options.combobox.options.fromCombo=!0),e.fetch(r,{success:function(e){if(t.success&&(o.options.combobox&&(o.options.combobox.options.expanded=!0),t.success(e),o&&o.options&&o.options.combobox&&o.options.combobox.span&&o.options.$compile(o.options.combobox.span)(o.options.scope),o.options.kendoCallback=t,o.options&&o.options.combobox&&o.options.combobox.element[0].id)){var a=" .k-animation-container",n=angular.element($(" .k-animation-container"));o.options.$compile(n)(o.options.scope)}},canceled:function(e){o.options.combobox&&(o.options.combobox.options.fromCombo=!1),t.success&&t.error("canceled","canceled","canceled")},error:function(e){o.options.combobox&&(o.options.combobox.options.fromCombo=!1),t.success&&t.error("error","error","error")}},!1,{ignoreAtive:!0})}},parseOptionsCronToConfigKendo:function(e,t,a){let n=!1;e.dynamic&&"false"!=e.dynamic?e.dataSourceScreen&&e.dataSourceScreen.entityDataSource&&(e.dataSourceScreen.entityDataSource.append=!0,t=app.kendoHelper.getDataSource(e.dataSourceScreen.entityDataSource,a,!0,e.dataSourceScreen.rowsPerPage),t.transport.read=app.kendoHelper.getEventReadCombo,n=!0):(n=!0,e.dataValueField=e.dataValueField||"value",e.dataTextField=e.dataTextField||"key"),e.dataValueField&&""!=e.dataValueField.trim()||(e.dataValueField=null==e.dataTextField?void 0:e.dataTextField);var i=function(t){var a=e.dataSourceScreen.entityDataSource.schemaFields;for(count=0;count<a.length;count++)if(t==a[count].name){return a[count].type.toLowerCase();break}return null},o=function(e){var t=["date","time","datetime"];return-1<t.indexOf(e)?e:null};!e.customTemplate&&e.dataSourceScreen&&e.dataSourceScreen.entityDataSource&&e.dataSourceScreen.entityDataSource.schemaFields&&(e.format||o(i(e.dataTextField)))&&(e.template="#= useMask("+e.dataTextField+",'"+e.format+"','"+i(e.dataTextField)+"') #",e.valueTemplate="#= useMask("+e.dataTextField+",'"+e.format+"','"+i(e.dataTextField)+"') #");var d={dataTextField:null==e.dataTextField?void 0:e.dataTextField,dataValueField:null==e.dataValueField?void 0:e.dataValueField,dataSource:t,headerTemplate:null==e.headerTemplate?void 0:e.headerTemplate,template:null==e.template?void 0:e.template,tagTemplate:null==e.tagTemplate?void 0:e.tagTemplate,placeholder:null==e.placeholder?void 0:e.placeholder,footerTemplate:null==e.footerTemplate?void 0:e.footerTemplate,filter:null==e.filter?void 0:e.filter,valuePrimitive:n,valueTemplate:null==e.valueTemplate?void 0:e.valueTemplate,suggest:!0};return e.optionLabel&&(e.optionLabelText=e.optionLabel,e.optionLabelValue=""),d.optionLabel={},d.optionLabel[d.dataTextField]=void 0===e.optionLabelText?"":e.optionLabelText,d.optionLabel[d.dataValueField]=void 0===e.optionLabelValue?null:e.optionLabelValue,d},getConfigComboboxSync:function(e,t){var a={};if(e){if(!e.dynamic||"false"==e.dynamic){a.data=null==e.staticDataSource?void 0:e.staticDataSource;for(let n=0;n<a.data.length;n++)try{a.data[n].key&&a.data[n].key.startsWith("cronapi.server(")&&(a.data[n].key=a.data[n].key.replace(".run(",".notAsync().run("));let e=t.$eval(a.data[n].key);a.data[n].key=void 0!==e&&null!==e?e:a.data[n].key}catch(t){a.data[n].key=a.data[n].key}}return config=this.parseOptionsCronToConfigKendo(e,a,t),config}return{}},getConfigCombobox:async function(e,t){var a={};if(e){if(!e.dynamic||"false"==e.dynamic){a.data=null==e.staticDataSource?void 0:e.staticDataSource;for(let n=0;n<a.data.length;n++)try{a.data[n].key&&a.data[n].key.startsWith("cronapi.server(")&&(a.data[n].key=a.data[n].key.replace(".run(",".toPromise().run("));let e=await t.$eval(a.data[n].key);a.data[n].key=void 0!==e&&null!==e?e:a.data[n].key}catch(t){a.data[n].key=a.data[n].key}}return config=this.parseOptionsCronToConfigKendo(e,a,t),config}return{}},getConfigDate:function(e,t){var a={};if(a){var n=function(e){e=e.replace(/_/gm,"-");var t=e.split("-");return t[t.length-1]=t[t.length-1].toUpperCase(),t.join("-")},i=function(e){return e&&(e=e.replace(/:MM/gm,":mm"),e=e.replace(/:M/gm,":m"),e=e.replace(/S/gm,"s"),e=e.replace(/D/gm,"d"),e=e.replace(/Y/gm,"y")),e},o=function(t,a){return null==a&&(a=parseMaskType(t,e)),a},d={};if(t.animation)try{d=JSON.parse(t.animation)}catch(e){console.log("DateAnimation invalid configuration! "+e)}var r=o(t.type,t.format),l=i(r),s=i(t.timeFormat),c=n(e.use());a={value:null,format:l,timeFormat:s,momentFormat:r,culture:c,type:null==t.type?void 0:t.type,weekNumber:null==t.weekNumber?void 0:t.weekNumber,dateInput:null==t.dateInput?void 0:t.dateInput,animation:d,footer:null==t.footer?void 0:t.footer,start:null==t.start?void 0:t.start,depth:null==t.start?void 0:t.start}}return a},buildKendoMomentPicker:function(e,t,a,n){var i="date"==t.type||"datetime"==t.type||"time"==t.type;window.fixedTimeZone||(i=!1),e.data("mask",t.momentFormat),e.data("useUTC",i);var o=function(){var a=e.val();if(!a||""==a.trim())n&&n.$setViewValue("");else{var o=formatWithMomentAs(t.momentFormat,i,a,"date");n&&(n.$setViewValue(o),e.data("changed",!0))}};return(t.change=a?function(){a.$apply(function(){o()})}:o,"date"==t.type)?e.kendoDatePicker(t).data("kendoDatePicker"):"datetime"==t.type||"datetime-local"==t.type?e.kendoDateTimePicker(t).data("kendoDateTimePicker"):"time"==t.type||"time-local"==t.type?e.kendoTimePicker(t).data("kendoTimePicker"):void 0},getConfigSlider:function(e){e=e||{};var t={increaseButtonTitle:e.increaseButtonTitle,decreaseButtonTitle:e.decreaseButtonTitle,dragHandleTitle:e.dragHandleTitle};try{t.min=e.min?parseInt(e.min):1,t.max=e.max?parseInt(e.max):1,t.smallStep=e.smallStep?parseInt(e.smallStep):1,t.largeStep=e.largeStep?parseInt(e.largeStep):1}catch(e){console.log("Slider invalid configuration! "+e)}return t},getConfigSwitch:function(e){e=e||{};var t={onLabel:null==e.onLabel?void 0:e.onLabel,offLabel:null==e.offLabel?void 0:e.offLabel};return t},getConfigBarcode:function(e){var t={type:null==e.type?void 0:e.type,width:null==e.width?void 0:parseInt(e.width),height:null==e.height?void 0:parseInt(e.height)};return t.type||(t.type="EAN8"),t},getConfigQrcode:function(e){var t={errorCorrection:null==e.errorCorrection?void 0:e.errorCorrection,size:null==e.size?void 0:parseInt(e.size),color:null==e.color?void 0:e.color};return(e.borderColor||e.borderSize)&&(t.border={size:null==e.size?void 0:parseInt(e.size),color:null==e.color?void 0:e.color}),t}},window.showTreatedValue=function(e){return e||!1===e?e:""},window.useMask=function(e,t,a){var n="";t="null"==t||"undefined"==t?void 0:t;var i=e,o=t||a;if(null!=e&&e!=null){if("string"==typeof e&&""===e.trim())return"";if(e instanceof Date){var d=moment(e).utcOffset(window.timeZoneOffset);i="\""+d.format()+"\""}else i="number"==typeof e?e:"\""+e+"\"";n="{{ "+i+" | mask:\""+o+"\":\""+a+"\"}}"}return n},window.formatWithMomentAs=function(e,t,a,n){if(!a)return;let i=null;return i=a instanceof Date||a.startsWith("/Date")?t?moment(a).utcOffset(window.timeZoneOffset):moment(a):t?moment(a,e).utcOffset(window.timeZoneOffset,!0):moment(a,e),"string"===n?i.format(e):i.toDate()};function cronFrame($compile,$sce,$parse){"use strict";return{restrict:"AE",link:function(scope,element,attrs,ngModelCtrl){scope.fragment=scope.fragment||{};var framentMap=scope.fragment[element.parent.id]||{};scope.$watch(function(){return attrs.origin},function(newVal){let template="",style=attrs.style||"",clazz=attrs.class||"";if(attrs.origin)if(attrs.type||(attrs.type="include"),"include"==attrs.type){let str=`<div style="${style}" class="${clazz}" ng-include="'${attrs.origin}'" ng-if="true"></div>`;if(template=$(str),attrs.params)try{let params=eval(attrs.params);for(let e in params){let t=params[e];"expression"==t.type?scope.$watch(t.value,function(e){framentMap[t.key]=e;var a=$(str);a.attr("onload",`params = ${JSON.stringify(framentMap)}`);var n=$compile(a)(scope);element.html(n)}):framentMap[t.key]=t.value}template.attr("onload",`params = ${JSON.stringify(framentMap)}`)}catch(e){console.error(e)}}else if("frame"==attrs.type){var url=$sce.trustAsResourceUrl(attrs.origin);template=$(`<iframe style="${style}" class="${clazz}" ng-src="${url}" width="100%" height="100%" loading="lazy"></iframe>`)}element.html(template),$compile(template)(scope)})}}}function cronReportViewer(e){return{restrict:"E",replace:!0,require:"ngModel",link:function(e,t,a,n){function i(a){var n=JSON.parse(a),i={element:t};e.$eval(n.reportCommand||n.dashboardCommand,i)}i(a.options);let o=t[0].parentElement;for(;o;)if("BODY"===o.tagName)o=null;else if(o.classList.contains("tab-pane"))break;else o=o.parentElement;if(o&&!o.classList.contains("active")){let e=new MutationObserver(function(e,t){for(let n of e)if("class"===n.attributeName&&n.target.classList.contains("active")){i(a.options),t.disconnect();break}});e.observe(o,{attributes:!0})}var d=null;e.$watch(function(){return a.options},function(e,t){e!==t&&(d&&(clearInterval(d),d=null),d=setTimeout(function(){i(e)}.bind(this),500))})}}}
package/js/directives.js CHANGED
@@ -7650,8 +7650,9 @@ window.useMask = function(value, format, type) {
7650
7650
  var resolvedType = format || type;
7651
7651
 
7652
7652
  if (value != null && value != undefined) {
7653
- if (value instanceof Date) {
7654
-
7653
+ if (typeof value === "string" && value.trim() === "") {
7654
+ return "";
7655
+ } else if (value instanceof Date) {
7655
7656
  var momentDate = moment(value).utcOffset(window.timeZoneOffset);
7656
7657
 
7657
7658
  resolvedValue = '"'+momentDate.format()+'"';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronapp-framework-js",
3
- "version": "3.2.1-SP.23",
3
+ "version": "3.2.1-SP.26",
4
4
  "description": "Javascript library for CronApp's projects",
5
5
  "main": "cronapp.framework.js",
6
6
  "scripts": {