cronapp-framework-js 3.0.0-SP.26 → 3.0.0-SP.28

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.
@@ -47,4 +47,4 @@ maskDirectiveAsDate.$inject=["$compile","$translate","$parse"],maskDirectiveMask
47
47
  ${s} ${c} ${l}
48
48
  </a>
49
49
  ${a(e.menuItems)}
50
- </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 l={};try{l=JSON.parse(d)}catch(t){console.log("CronDynamicMenu: Invalid configuration!")}let r=l&&l.subMenuOptions&&l.subMenuOptions.length?l.subMenuOptions[0].id:"first";var s=`<ul id="menu-tag-ul-base-${r}" class="nav navbar-nav ${t?"col-md-12 padding-0":""}" ></ul>`,c=$(s);c.attr("id",i.id);var p=o(l,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")})})})}}}]).directive("cronBreadcrumbs",["$rootScope",function(e){"use strict";return{restrict:"E",replace:!0,link:function(e,t,a){var n=a.ngInit?a.ngInit:null;const i=a.crnDelimiterIcon,o=a.typeMenu,d=a.idMenu?a.idMenu:null,l=a.id,r=a.breadcrumbIcon?a.breadcrumbIcon:null,s=[],c=async()=>{const t=n.replace("cronapi.client('js.","blockly.js.");n=t.replace("').run()",""),n=e.$eval(n),s=await n();const a=async t=>{t.item.action&&t.item.action()};$(`#${l}`).kendoBreadcrumb({items:s,delimiterIcon:i,navigational:!0,click:a})},p=e=>e?e.replace("cronapi.screen.changeView('","").replace("', [])",""):"#/home";if(n&&"idBloco"===o)c();else{var u=new MutationObserver((e,t)=>{const a=$(`#${d}`).parent(),n=a.attr("options");if(n){t.disconnect();const e=JSON.parse(n),a=document.location.hash||"home",d=(e,t,a=[])=>{for(let o=0;o<e.length;o++){var n=e[o];if(n.action=p(n.action),n.action===t)return[...a,n];if(n.menuItems){const e=d(n.menuItems,t,[...a,n]);if(e)return e}}return null},r=d(e.subMenuOptions,a);if(r){for(var o in r){const e=r[o];s.push({type:0==o?"rootitem":"item",href:e.action,text:e.title,showText:!0,showIcon:!1})}$(`#${l}`).kendoBreadcrumb({items:s,delimiterIcon:i,navigational:!0})}}});u.observe(document.body,{childList:!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),l=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()),l(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(""),l=e=>"true"===e||void 0===e||null===e||0==e.length;n.$render=l(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,l){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 r=!1;$(a).on("pointerdown",t=>{1===t.which&&(r=!0),t.preventDefault()}),$(a).on("pointerup",t=>{1===t.which&&r&&(r=!1,l(()=>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,l=$(`<script src="${o}get-chat?token=${d}" type="text/javascript"></script>`);t.html(l)}}}}]).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,l=n.listType,r=a[0].children[0].children;r=$(r);let s="",c="";$.each(r,function(e,t){c+=t.outerHTML});"numbered-list"===l?s=`<ol style="list-style-type: ${o}">${c}</ol>`:"ordered-list"===l?s=`<ul style="list-style-type: ${d}">${c}</ul>`:void 0;s=$(s),$(a).replaceWith(s),e(s)(t)}}}]).directive("crnInfiniteScroll",["$compile",function($compile){"use strict";return{restrict:"EA",link:function(scope,element,attrs){var dataSource=attrs.crnInfiniteScroll?eval(attrs.crnInfiniteScroll):attrs.crnDatasource?eval(attrs.crnDatasource):void 0;if(dataSource){let e={isVisible:!1,checkVisibility:function(t){if(e.isVisible!==t&&(e.isVisible=t,e.isVisible))if(dataSource.loaded&&dataSource.loadedFinish)dataSource.nextPage();else{let e=setInterval(function(){dataSource.loaded&&dataSource.loadedFinish&&(dataSource.nextPage(),clearInterval(e))},250)}},eventScroll:function(){var t=element.offset().top,a=element.offset().top+element.outerHeight(),n=$(window).scrollTop()+$(window).innerHeight(),i=$(window).scrollTop();e.checkVisibility(n>t&&i<a)}};$(window).scroll(e.eventScroll),$(window).ready(e.eventScroll)}}}}])}(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,l){if("as-date"!=n||void 0===d.mask){var r=a(d.ngModel),s=r.assign,c=$(o);if(!c.data("alreadycompiled")){c.data("alreadycompiled",!0),c.data("$compile",e);var p=c.attr("type");if("checkbox"!=p&&"password"!=p&&"url"!=p){if("color"==p||"range"==p)return c[0].classList.remove("form-control"),void c[0].classList.remove("k-textbox");c.data("type",p),c.attr("type","text"),l&&(l.$formatters=[],l.$parsers=[]),void 0!==d.asDate&&"text"==p&&(p="date");var u=!0,m=!1,g=d.mask||d.format;g=g?parseMaskType(g,t):parseMaskType(p,t),g.endsWith(";0")&&(m=!0);var f=g.replace(";1","").replace(";0","").trim();if(null!=f&&0!=f.length)if("date"==p||"datetime"==p||"datetime-local"==p||"month"==p||"time"==p||"time-local"==p||"week"==p){var h={format:f,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")}};"DD/MM/YYYY"!=f&&"MM/DD/YYYY"!=f&&(h.sideBySide=!0);var v="date"==p||"datetime"==p||"time"==p;if(window.fixedTimeZone||(v=!1),c.data("mask",f),c.data("useUTC",v),c.attr("from-grid")){var b=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(c.on("click",b),c.on("focus",function(){setTimeout(b.bind(this),100)}),c.on("dp.change",function(){i.safeApply(function(){var e=null;e=v?moment(c.val(),f).utcOffset(window.timeZoneOffset,!0):moment(c.val(),f),("time"==p||"time-local"==p)&&(e=e.year(1970).dayOfYear(1).month(0)),e.isValid()&&l&&s(i,e.toDate())})}),c.data("initial-value")){var y=c.data("initial-value"),k=null;k=v?moment(y).utcOffset(window.timeZoneOffset):moment(y),c.val(k.format(f)),c.data("initial-value",null)}}else c.wrap("<div style=\"position:relative\"></div>");c.datetimepicker(h),"true"!==d.fromGrid&&c.on("dp.change",function(){$(this).is(":visible")&&($(this).trigger("change"),i.safeApply(function(){var e=c.val(),t=null;t=v?moment(e,f).utcOffset(window.timeZoneOffset,!0):moment(e,f),("time"==p||"time-local"==p)&&(t=t.year(1970).dayOfYear(1).month(0)),t.isValid()&&l&&s(i,t.toDate())}))}),l&&(l.$formatters.push(function(e){if(e)return formatWithMomentAs(f,v,e,"string");if(null===e){var t=c.datetimepicker(h).data("DateTimePicker");t.date(null)}return null}),l.$parsers.push(function(e){if(e){if(e instanceof Date)return e;var t=null;return t=v?moment(e,f).utcOffset(window.timeZoneOffset,!0):moment(e,f),("time"==p||"time-local"==p)&&(t=t.year(1970).dayOfYear(1).month(0)),t.toDate()}return null}))}else if("number"==p||"money"==p||"integer"==p||"money-decimal"==p){m=!0;var C=f.trim().replace(/\./g,"").replace(/\,/g,"").replace(/#/g,"").replace(/0/g,"").replace(/9/g,""),S="",w="",D="",T=",",M=0;f.startsWith(C)?S=C:f.endsWith(C)&&(w=C);var x=f.trim().replace(S,"").replace(w,"").trim();x.startsWith("#.")?D=".":x.startsWith("#,")&&(D=",");var E=null;if(-1==x.indexOf(",0")?-1!=x.indexOf(".0")&&(T=".",E=".0"):(T=",",E=",0"),null!=E){var I=x.substring(x.indexOf(E)+1);M=I.length}var A="numeric";0==M&&(A="integer"),"money-decimal"==p&&(A="currency");var F={rightAlign:"money"==p||"money-decimal"==p,unmaskAsNumber:!0,allowMinus:!0,prefix:S,suffix:w,radixPoint:T,digits:M,numericInput:"money-decimal"==p};D&&(F.autoGroup=!0,F.groupSeparator=D),$(o).inputmask(A,F),useInputMaskPlugin(o,l,i,s,f)}else if("text"==p||"tel"==p||"string"==p){let e=["D","M","Y","H","m","s"],t=t=>(e.forEach(e=>t=t.replaceAll(e,"9")),t);f=t(f),d.maskPlaceholder?(h={},h.placeholder=d.maskPlaceholder,$(o).inputmask(f,h),m&&useInputMaskPlugin(o,l,i,s,f)):(c.mask(f),useMaskPlugin(o,l,i,s,m))}}}}}}}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)return 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 l=Number.MAX_SAFE_INTEGER_32;function r(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=l,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},r=!1;t.append&&(r=t.append);var s={};"button"===n.loadDataStrategy&&0<n.data.length&&(s.origin=n.loadDataStrategy),n.append=r,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")}},r,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:r};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){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,l={};l.params=i,o.options.combobox&&(o.options.combobox.options.fromCombo=!0),e.fetch(l,{success:function(e){if(t.success&&(o.options.combobox&&(o.options.combobox.options.expanded=!0),t.success(e),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 l=o(t.type,t.format),r=i(l),s=i(t.timeFormat),c=n(e.use());a={value:null,format:r,timeFormat:s,momentFormat:l,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);var o=null;e.$watch(function(){return a.options},function(e,t){e!==t&&(o&&(clearInterval(o),o=null),o=setTimeout(function(){i(e)}.bind(this),500))})}}}
50
+ </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 l={};try{l=JSON.parse(d)}catch(t){console.log("CronDynamicMenu: Invalid configuration!")}let r=l&&l.subMenuOptions&&l.subMenuOptions.length?l.subMenuOptions[0].id:"first";var s=`<ul id="menu-tag-ul-base-${r}" class="nav navbar-nav ${t?"col-md-12 padding-0":""}" ></ul>`,c=$(s);c.attr("id",i.id);var p=o(l,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")})})})}}}]).directive("cronBreadcrumbs",["$rootScope",function(e){"use strict";return{restrict:"E",replace:!0,link:function(e,t,a){var n=a.ngInit?a.ngInit:null;const i=a.crnDelimiterIcon,o=a.typeMenu,d=a.idMenu?a.idMenu:null,l=a.id,r=a.breadcrumbIcon?a.breadcrumbIcon:null,s=[],c=async()=>{const t=n.replace("cronapi.client('js.","blockly.js.");n=t.replace("').run()",""),n=e.$eval(n),s=await n();const a=async t=>{t.item.action&&t.item.action()};$(`#${l}`).kendoBreadcrumb({items:s,delimiterIcon:i,navigational:!0,click:a})},p=e=>e?e.replace("cronapi.screen.changeView('","").replace("', [])",""):"#/home";if(n&&"idBloco"===o)c();else{var u=new MutationObserver((e,t)=>{const a=$(`#${d}`).parent(),n=a.attr("options");if(n){t.disconnect();const e=JSON.parse(n),a=document.location.hash||"home",d=(e,t,a=[])=>{for(let o=0;o<e.length;o++){var n=e[o];if(n.action=p(n.action),n.action===t)return[...a,n];if(n.menuItems){const e=d(n.menuItems,t,[...a,n]);if(e)return e}}return null},r=d(e.subMenuOptions,a);if(r){for(var o in r){const e=r[o];s.push({type:0==o?"rootitem":"item",href:e.action,text:e.title,showText:!0,showIcon:!1})}$(`#${l}`).kendoBreadcrumb({items:s,delimiterIcon:i,navigational:!0})}}});u.observe(document.body,{childList:!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),l=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()),l(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(""),l=e=>"true"===e||void 0===e||null===e||0==e.length;n.$render=l(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,l){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 r=!1;$(a).on("pointerdown",t=>{1===t.which&&(r=!0),t.preventDefault()}),$(a).on("pointerup",t=>{1===t.which&&r&&(r=!1,l(()=>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,l=$(`<script src="${o}get-chat?token=${d}" type="text/javascript"></script>`);t.html(l)}}}}]).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,l=n.listType,r=a[0].children[0].children;r=$(r);let s="",c="";$.each(r,function(e,t){c+=t.outerHTML});"numbered-list"===l?s=`<ol style="list-style-type: ${o}">${c}</ol>`:"ordered-list"===l?s=`<ul style="list-style-type: ${d}">${c}</ul>`:void 0;s=$(s),$(a).replaceWith(s),e(s)(t)}}}]).directive("crnInfiniteScroll",["$compile",function($compile){"use strict";return{restrict:"EA",link:function(scope,element,attrs){var dataSource=attrs.crnInfiniteScroll?eval(attrs.crnInfiniteScroll):attrs.crnDatasource?eval(attrs.crnDatasource):void 0;if(dataSource){let e={isVisible:!1,checkVisibility:function(t){if(e.isVisible!==t&&(e.isVisible=t,e.isVisible))if(dataSource.loaded&&dataSource.loadedFinish)dataSource.nextPage();else{let e=setInterval(function(){dataSource.loaded&&dataSource.loadedFinish&&(dataSource.nextPage(),clearInterval(e))},250)}},eventScroll:function(){var t=element.offset().top,a=element.offset().top+element.outerHeight(),n=$(window).scrollTop()+$(window).innerHeight(),i=$(window).scrollTop();e.checkVisibility(n>t&&i<a)}};$(window).scroll(e.eventScroll),$(window).ready(e.eventScroll)}}}}])}(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,l){if("as-date"!=n||void 0===d.mask){var r=a(d.ngModel),s=r.assign,c=$(o);if(!c.data("alreadycompiled")){c.data("alreadycompiled",!0),c.data("$compile",e);var p=c.attr("type");if("checkbox"!=p&&"password"!=p&&"url"!=p){if("color"==p||"range"==p)return c[0].classList.remove("form-control"),void c[0].classList.remove("k-textbox");c.data("type",p),c.attr("type","text"),l&&(l.$formatters=[],l.$parsers=[]),void 0!==d.asDate&&"text"==p&&(p="date");var u=!0,m=!1,g=d.mask||d.format;g=g?parseMaskType(g,t):parseMaskType(p,t),g.endsWith(";0")&&(m=!0);var f=g.replace(";1","").replace(";0","").trim();if(null!=f&&0!=f.length)if("date"==p||"datetime"==p||"datetime-local"==p||"month"==p||"time"==p||"time-local"==p||"week"==p){var h={format:f,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")}};"DD/MM/YYYY"!=f&&"MM/DD/YYYY"!=f&&(h.sideBySide=!0);var v="date"==p||"datetime"==p||"time"==p;if(window.fixedTimeZone||(v=!1),c.data("mask",f),c.data("useUTC",v),c.attr("from-grid")){var b=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(c.on("click",b),c.on("focus",function(){setTimeout(b.bind(this),100)}),c.on("dp.change",function(){i.safeApply(function(){var e=null;e=v?moment(c.val(),f).utcOffset(window.timeZoneOffset,!0):moment(c.val(),f),("time"==p||"time-local"==p)&&(e=e.year(1970).dayOfYear(1).month(0)),e.isValid()&&l&&s(i,e.toDate())})}),c.data("initial-value")){var y=c.data("initial-value"),k=null;k=v?moment(y).utcOffset(window.timeZoneOffset):moment(y),c.val(k.format(f)),c.data("initial-value",null)}}else c.wrap("<div style=\"position:relative\"></div>");c.datetimepicker(h),"true"!==d.fromGrid&&c.on("dp.change",function(){$(this).is(":visible")&&($(this).trigger("change"),i.safeApply(function(){var e=c.val(),t=null;t=v?moment(e,f).utcOffset(window.timeZoneOffset,!0):moment(e,f),("time"==p||"time-local"==p)&&(t=t.year(1970).dayOfYear(1).month(0)),t.isValid()&&l&&s(i,t.toDate())}))}),l&&(l.$formatters.push(function(e){if(e)return formatWithMomentAs(f,v,e,"string");if(null===e){var t=c.datetimepicker(h).data("DateTimePicker");t.date(null)}return null}),l.$parsers.push(function(e){if(e){if(e instanceof Date)return e;var t=null;return t=v?moment(e,f).utcOffset(window.timeZoneOffset,!0):moment(e,f),("time"==p||"time-local"==p)&&(t=t.year(1970).dayOfYear(1).month(0)),t.toDate()}return null}))}else if("number"==p||"money"==p||"integer"==p||"money-decimal"==p){m=!0;var C=f.trim().replace(/\./g,"").replace(/\,/g,"").replace(/#/g,"").replace(/0/g,"").replace(/9/g,""),S="",w="",D="",T=",",M=0;f.startsWith(C)?S=C:f.endsWith(C)&&(w=C);var x=f.trim().replace(S,"").replace(w,"").trim();x.startsWith("#.")?D=".":x.startsWith("#,")&&(D=",");var E=null;if(-1==x.indexOf(",0")?-1!=x.indexOf(".0")&&(T=".",E=".0"):(T=",",E=",0"),null!=E){var I=x.substring(x.indexOf(E)+1);M=I.length}var A="numeric";0==M&&(A="integer"),"money-decimal"==p&&(A="currency");var F={rightAlign:"money"==p||"money-decimal"==p,unmaskAsNumber:!0,allowMinus:!0,prefix:S,suffix:w,radixPoint:T,digits:M,numericInput:"money-decimal"==p};D&&(F.autoGroup=!0,F.groupSeparator=D),$(o).inputmask(A,F),useInputMaskPlugin(o,l,i,s,f)}else if("text"==p||"tel"==p||"string"==p){let e=["D","M","Y","H","m","s"],t=t=>(e.forEach(e=>t=t.replaceAll(e,"9")),t);f=t(f),d.maskPlaceholder?(h={},h.placeholder=d.maskPlaceholder,$(o).inputmask(f,h),m&&useInputMaskPlugin(o,l,i,s,f)):(c.mask(f),useMaskPlugin(o,l,i,s,m))}}}}}}}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)return 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 l=Number.MAX_SAFE_INTEGER_32;function r(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=l,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},r=!1;t.append&&(r=t.append);var s={};"button"===n.loadDataStrategy&&0<n.data.length&&(s.origin=n.loadDataStrategy),n.append=r,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")}},r,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:r};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){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,l={};l.params=i,o.options.combobox&&(o.options.combobox.options.fromCombo=!0),e.fetch(l,{success:function(e){if(t.success&&(o.options.combobox&&(o.options.combobox.options.expanded=!0),t.success(e),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 l=o(t.type,t.format),r=i(l),s=i(t.timeFormat),c=n(e.use());a={value:null,format:r,timeFormat:s,momentFormat:l,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))})}}}
package/js/directives.js CHANGED
@@ -7291,6 +7291,33 @@ function cronReportViewer($compile) {
7291
7291
 
7292
7292
  executeReport(attrs.options);
7293
7293
 
7294
+ // Não inicia em em Tab não ativa
7295
+ // Verifica se esta dentro de um tab
7296
+ let elementTab = element[0].parentElement;
7297
+ while (elementTab) {
7298
+ if (elementTab.tagName === "BODY") {
7299
+ elementTab = null;
7300
+ } else if (elementTab.classList.contains("tab-pane")) {
7301
+ break;
7302
+ } else {
7303
+ elementTab = elementTab.parentElement;
7304
+ }
7305
+ }
7306
+ // Se estiver dentro de um tab e esta não estiver ativa, inclui observador para ler o relatorio ao ativar a tab
7307
+ if (elementTab && !elementTab.classList.contains("active")) {
7308
+ let observerClassChange = new MutationObserver(function(mutationsList, observer) {
7309
+ for (let mutation of mutationsList) {
7310
+ if (mutation.attributeName === "class" && mutation.target.classList.contains("active")) {
7311
+ executeReport(attrs.options);
7312
+ // Desconecta observador, pois só precisa ser executado uma vez.
7313
+ observer.disconnect();
7314
+ break;
7315
+ }
7316
+ }
7317
+ });
7318
+ observerClassChange.observe(elementTab, { attributes: true });
7319
+ }
7320
+
7294
7321
  var filterTimeout = null;
7295
7322
  scope.$watch(function(){ return attrs.options }, function(value, old){
7296
7323
  if (value !== old) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronapp-framework-js",
3
- "version": "3.0.0-SP.26",
3
+ "version": "3.0.0-SP.28",
4
4
  "description": "Javascript library for CronApp's projects",
5
5
  "main": "cronapp.framework.js",
6
6
  "scripts": {