gl-w-frontend
Advanced tools
Comparing version 1.4.15-alpha to 1.4.15-alpha2
@@ -1,1 +0,1 @@ | ||
import{$,jQuery}from"jquery";window.$=$;window.jQuery=jQuery;export*from"./scripts/core/services/array/core-services-array.service";export*from"./scripts/core/services/attachment/core-services-attachment.service";export*from"./scripts/core/services/browser/core-services-browser.service";export*from"./scripts/core/services/combobox/core-services-combobox.service";export*from"./scripts/core/services/date/core-services-date.service";export*from"./scripts/core/services/elements/core-services-elements.service";export*from"./scripts/core/services/input/core-services-input.service";export*from"./scripts/core/services/string/core-services-string.service";export*from"./scripts/core/services/url/core-services-url.service";export*from"./scripts/services/export/excel/services-export-excel.service"; | ||
import*as $ from"jquery";window.$=window.jQuery=$;export*from"./scripts/core/services/array/core-services-array.service";export*from"./scripts/core/services/attachment/core-services-attachment.service";export*from"./scripts/core/services/browser/core-services-browser.service";export*from"./scripts/core/services/combobox/core-services-combobox.service";export*from"./scripts/core/services/date/core-services-date.service";export*from"./scripts/core/services/elements/core-services-elements.service";export*from"./scripts/core/services/input/core-services-input.service";export*from"./scripts/core/services/string/core-services-string.service";export*from"./scripts/core/services/url/core-services-url.service";export*from"./scripts/services/export/excel/services-export-excel.service"; |
@@ -1,1 +0,1 @@ | ||
import{__awaiter}from"tslib";import{Subject}from"rxjs";import*as Excel from"xlsx";import*as XlsxPopulate from"xlsx-populate/browser/xlsx-populate.min.js";import{BrowserVersion}from"../../../core/services/browser/core-services-browser.service";import{DateGet}from"../../../core/services/date/core-services-date.service";class Core{constructor(){this.status$=new Subject}static headerAndContent(workbook,sheetName,header,content,width=null,style={},addSheet=true){const headerStyle={fill:"64666C",fontColor:"FFFFFF",horizontalAlignment:"center"};if(addSheet){workbook.addSheet(sheetName)}workbook.sheet(sheetName).cell("A1").value(content);for(const[i,h]of header.entries()){const _h=h.length==null?50:h.length;const _width=width==null?_h:width;workbook.sheet(sheetName).row(1).cell(i+1).style(headerStyle);workbook.sheet(sheetName).column(i+1).width(1.5*_width).style(style)}}static parseDatabaseData(workbook,dataArray,sheetName,addSheet){const _header=[];const _content=[];if(!addSheet){workbook.sheet(0).name(sheetName)}for(const key of Object.keys(dataArray[0])){_header.push(key)}let temp=[];for(const d of dataArray){for(const h of _header){temp.push(d[h])}_content.push(temp);temp=[]}_content.unshift(_header);Core.headerAndContent(workbook,sheetName,_header,_content,null,{},addSheet)}static saveFileIE(content,sheetName,_fileName=null){return __awaiter(this,void 0,void 0,(function*(){const currentDate=DateGet.customDate((new Date).toISOString(),"YYYYMMDD_HHMMss");const fileName=_fileName==null?`Export ${currentDate}`:`${_fileName}`;const fileNameWidthDate=`${fileName} ${currentDate}.xlsx`;const ws=Excel.utils.json_to_sheet(content);const wb=Excel.utils.book_new();Excel.utils.book_append_sheet(wb,ws,sheetName);yield Excel.writeFile(wb,fileNameWidthDate,{cellStyles:true});return{code:200,message:"File saved successfully"}}))}saveFile(workbook,_fileName=null){return new Promise((resolve,reject)=>{workbook.outputAsync().then(blob=>{const currentDate=DateGet.customDate((new Date).toISOString(),"YYYYMMDD_HHMMss");const fileName=_fileName==null?`Template RDA ${currentDate}.xlsx`:`${_fileName} ${currentDate}.xlsx`;if(window.navigator&&window.navigator.msSaveOrOpenBlob){window.navigator.msSaveOrOpenBlob(blob,fileName)}else{const url=window.URL.createObjectURL(blob);const a=document.createElement("a");document.body.appendChild(a);a.href=url;a.download=fileName;a.click();window.URL.revokeObjectURL(url);document.body.removeChild(a)}resolve({code:200,message:"File saved successfully"})}).catch(reason=>{reject(reason)})})}exportDatabase(userData,sheetName,fileName,firstSheet=true){this.status$.next("Criando planilha do Excel...");return new Promise(resolve=>__awaiter(this,void 0,void 0,(function*(){if(BrowserVersion.isBeforeIE11()){const result=yield Core.saveFileIE(userData,sheetName,fileName);this.status$.next(result.message);if(result.code===200){resolve(result.message)}else{throw new Error(result.message)}}else{XlsxPopulate.fromBlankAsync().then(workbook=>__awaiter(this,void 0,void 0,(function*(){Core.parseDatabaseData(workbook,userData,sheetName,!firstSheet);const result=yield this.saveFile(workbook,fileName);if(result.code===200){resolve(result.message)}else{throw new Error(result.message)}}))).catch(error=>{throw new Error(`Não foi possível criar o template. Erro: ${error.message}`)}).finally(()=>{this.clearSubject()})}})))}clearSubject(){this.status$.observers.map(x=>x.complete())}}export const ExportExcelCore=new Core; | ||
var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P((function(resolve){resolve(value)}))}return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))};import{Subject}from"rxjs";import*as Excel from"xlsx";import*as XlsxPopulate from"xlsx-populate/browser/xlsx-populate.min.js";import{BrowserVersion}from"../../../core/services/browser/core-services-browser.service";import{DateGet}from"../../../core/services/date/core-services-date.service";class Core{constructor(){this.status$=new Subject}static headerAndContent(workbook,sheetName,header,content,width=null,style={},addSheet=true){const headerStyle={fill:"64666C",fontColor:"FFFFFF",horizontalAlignment:"center"};if(addSheet){workbook.addSheet(sheetName)}workbook.sheet(sheetName).cell("A1").value(content);for(const[i,h]of header.entries()){const _h=h.length==null?50:h.length;const _width=width==null?_h:width;workbook.sheet(sheetName).row(1).cell(i+1).style(headerStyle);workbook.sheet(sheetName).column(i+1).width(1.5*_width).style(style)}}static parseDatabaseData(workbook,dataArray,sheetName,addSheet){const _header=[];const _content=[];if(!addSheet){workbook.sheet(0).name(sheetName)}for(const key of Object.keys(dataArray[0])){_header.push(key)}let temp=[];for(const d of dataArray){for(const h of _header){temp.push(d[h])}_content.push(temp);temp=[]}_content.unshift(_header);Core.headerAndContent(workbook,sheetName,_header,_content,null,{},addSheet)}static saveFileIE(content,sheetName,_fileName=null){return __awaiter(this,void 0,void 0,(function*(){const currentDate=DateGet.customDate((new Date).toISOString(),"YYYYMMDD_HHMMss");const fileName=_fileName==null?`Export ${currentDate}`:`${_fileName}`;const fileNameWidthDate=`${fileName} ${currentDate}.xlsx`;const ws=Excel.utils.json_to_sheet(content);const wb=Excel.utils.book_new();Excel.utils.book_append_sheet(wb,ws,sheetName);yield Excel.writeFile(wb,fileNameWidthDate,{cellStyles:true});return{code:200,message:"File saved successfully"}}))}saveFile(workbook,_fileName=null){return new Promise((resolve,reject)=>{workbook.outputAsync().then(blob=>{const currentDate=DateGet.customDate((new Date).toISOString(),"YYYYMMDD_HHMMss");const fileName=_fileName==null?`Template RDA ${currentDate}.xlsx`:`${_fileName} ${currentDate}.xlsx`;if(window.navigator&&window.navigator.msSaveOrOpenBlob){window.navigator.msSaveOrOpenBlob(blob,fileName)}else{const url=window.URL.createObjectURL(blob);const a=document.createElement("a");document.body.appendChild(a);a.href=url;a.download=fileName;a.click();window.URL.revokeObjectURL(url);document.body.removeChild(a)}resolve({code:200,message:"File saved successfully"})}).catch(reason=>{reject(reason)})})}exportDatabase(userData,sheetName,fileName,firstSheet=true){this.status$.next("Criando planilha do Excel...");return new Promise(resolve=>__awaiter(this,void 0,void 0,(function*(){if(BrowserVersion.isBeforeIE11()){const result=yield Core.saveFileIE(userData,sheetName,fileName);this.status$.next(result.message);if(result.code===200){resolve(result.message)}else{throw new Error(result.message)}}else{XlsxPopulate.fromBlankAsync().then(workbook=>__awaiter(this,void 0,void 0,(function*(){Core.parseDatabaseData(workbook,userData,sheetName,!firstSheet);const result=yield this.saveFile(workbook,fileName);if(result.code===200){resolve(result.message)}else{throw new Error(result.message)}}))).catch(error=>{throw new Error(`Não foi possível criar o template. Erro: ${error.message}`)}).finally(()=>{this.clearSubject()})}})))}clearSubject(){this.status$.observers.map(x=>x.complete())}}export const ExportExcelCore=new Core; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var tslib_1=require("tslib");var jquery_1=require("jquery");window.$=jquery_1.$;window.jQuery=jquery_1.jQuery;tslib_1.__exportStar(require("./scripts/core/services/array/core-services-array.service"),exports);tslib_1.__exportStar(require("./scripts/core/services/attachment/core-services-attachment.service"),exports);tslib_1.__exportStar(require("./scripts/core/services/browser/core-services-browser.service"),exports);tslib_1.__exportStar(require("./scripts/core/services/combobox/core-services-combobox.service"),exports);tslib_1.__exportStar(require("./scripts/core/services/date/core-services-date.service"),exports);tslib_1.__exportStar(require("./scripts/core/services/elements/core-services-elements.service"),exports);tslib_1.__exportStar(require("./scripts/core/services/input/core-services-input.service"),exports);tslib_1.__exportStar(require("./scripts/core/services/string/core-services-string.service"),exports);tslib_1.__exportStar(require("./scripts/core/services/url/core-services-url.service"),exports);tslib_1.__exportStar(require("./scripts/services/export/excel/services-export-excel.service"),exports); | ||
"use strict";function __export(m){for(var p in m)if(!exports.hasOwnProperty(p))exports[p]=m[p]}Object.defineProperty(exports,"__esModule",{value:true});var $=require("jquery");window.$=window.jQuery=$;__export(require("./scripts/core/services/array/core-services-array.service"));__export(require("./scripts/core/services/attachment/core-services-attachment.service"));__export(require("./scripts/core/services/browser/core-services-browser.service"));__export(require("./scripts/core/services/combobox/core-services-combobox.service"));__export(require("./scripts/core/services/date/core-services-date.service"));__export(require("./scripts/core/services/elements/core-services-elements.service"));__export(require("./scripts/core/services/input/core-services-input.service"));__export(require("./scripts/core/services/string/core-services-string.service"));__export(require("./scripts/core/services/url/core-services-url.service"));__export(require("./scripts/services/export/excel/services-export-excel.service")); |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var tslib_1=require("tslib");var Convert=function(){function Convert(){}Convert.prototype.textFileToUrlImage=function(file){return new Promise((function(resolve){var fileReader=new FileReader;fileReader.addEventListener("load",(function(e){resolve(e.target.result)}));fileReader.readAsDataURL(file)}))};return Convert}();exports.AttachmentConvert=new Convert;var Clean=function(){function Clean(){}Clean.prototype.cleanAttachmentText=function(string){return string.replace(/€/g,"").replace(/`/g,"").replace(/„/g,"").replace(/…/g,"").replace(/†/g,"").replace(/‡/g,"").replace(/ˆ/g,"").replace(/‰/g,"").replace(/Š/g,"").replace(/‹/g,"").replace(/Œ/g,"").replace(//g,"").replace(/Ž/g,"").replace(//g,"").replace(/‘/g,"").replace(/’/g,"").replace(/“/g,"").replace(/”/g,"").replace(/•/g,"").replace(/˜/g,"").replace(/™/g,"").replace(/š/g,"").replace(/›/g,"").replace(/œ/g,"").replace(/ž/g,"").replace(/Ÿ/g,"").replace(/¢/g,"").replace(/£/g,"").replace(/¤/g,"").replace(/¥/g,"").replace(/¦/g,"").replace(/§/g,"").replace(/¨/g,"").replace(/©/g,"").replace(/ª/g,"").replace(/«/g,"").replace(/¬/g,"").replace(/®/g,"").replace(/¯/g,"").replace(/°/g,"").replace(/±/g,"").replace(/²/g,"").replace(/³/g,"").replace(/´/g,"").replace(/µ/g,"").replace(/¶/g,"").replace(/·/g,"").replace(/¹/g,"").replace(/º/g,"").replace(/»/g,"").replace(/¼/g,"").replace(/½/g,"").replace(/¾/g,"").replace(/¿/g,"").replace(/Å/g,"A").replace(/Æ/g,"A").replace(/Ð/g,"D").replace(/Ø/g,"O").replace(/ß/g,"B").replace(/æ/g,"a").replace(/÷/g,"").replace(/ø/g,"o").replace(/þ/g,"b").replace(/!/g,"").replace(/"/g,"").replace(/#/g,"").replace(/\$/g,"").replace(/%/g,"").replace(/&/g,"").replace(/'/g,"").replace(/\(/g,"").replace(/\)/g,"").replace(/\*/g,"").replace(/\+/g,"").replace(/\//g,"").replace(/:/g,"").replace(/;/g,"").replace(/</g,"").replace(/=/g,"").replace(/>/g,"").replace(/\?/g,"").replace(/@/g,"").replace(/\[/g,"").replace(/\\/g,"").replace(/]/g,"").replace(/\^/g,"").replace(/_/g,"").replace(/`/g,"").replace(/{/g,"").replace(/\|/g,"").replace(/}/g,"").replace(/~/g,"").replace(/`/g,"").replace(//g,"").replace(/ƒ/g,"f").replace(/„/g,"").replace(/…/g,"").replace(/†/g,"").replace(/‡/g,"").replace(/ˆ/g,"").replace(/‰/g,"").replace(/Š/g,"").replace(/‹/g,"").replace(/Œ/g,"").replace(//g,"").replace(/Ž/g,"Z").replace(//g,"").replace(//g,"").replace(/‘/g,"").replace(/’/g,"").replace(/“/g,"").replace(/”/g,"").replace(/•/g,"").replace(/–/g,"").replace(/—/g,"").replace(/˜/g,"").replace(/™/g,"").replace(/š/g,"").replace(/›/g,"").replace(/œ/g,"").replace(//g,"").replace(/ž/g,"z").replace(/Ÿ/g,"Y").replace(/¡/g,"").replace(/¢/g,"c").replace(/£/g,"").replace(/¤/g,"").replace(/¥/g,"Y").replace(/¦/g,"").replace(/§/g,"").replace(/¨/g,"").replace(/©/g,"").replace(/ª/g,"").replace(/«/g,"").replace(/¬/g,"").replace(/®/g,"").replace(/¯/g,"").replace(/°/g,"").replace(/±/g,"").replace(/²/g,"2").replace(/³/g,"3").replace(/´/g,"").replace(/µ/g,"u").replace(/¶/g,"").replace(/·/g,"").replace(/¹/g,"1").replace(/º/g,"").replace(/»/g,"").replace(/¼/g,"").replace(/½/g,"").replace(/¾/g,"").replace(/¿/g,"").replace(/Ð/g,"D").replace(/ß/g,"B").replace(/æ/g,"a").replace(/÷/g,"").replace(/ø/g,"o").replace(/þ/g,"b").replace(/&/g,"").replace(/</g,"").replace(/>/g,"")};return Clean}();exports.AttachmentClean=new Clean;var Icon=function(){function Icon(){}Icon.prototype.get=function(fileName,url){if(url===void 0){url="assets/img/icon/attachment-icons/"}var extension=this.extension(fileName);var fileIcon;switch(extension.toLowerCase()){case"pdf":fileIcon=url+"adobe-pdf.svg";break;case"txt":fileIcon=url+"txt.svg";break;case"ooxml":fileIcon=url+"ms-office-365.svg";break;case"jpeg":case"jpg":case"png":case"gif":case"tiff":case"raw":case"svg":case"bmp":case"emf":case"svgz":fileIcon=url+"image-icon.svg";break;case"avi":case"flv":case"wmv":case"mov":case"mp4":case"mpeg":case"3gp":case"ogg":case"webm":case"hdv":case"vob":case"wav":fileIcon=url+"video-icon.svg";break;case"doc":case"dot":case"wbk":case"docx":case"docm":case"dotx":case"dotm":case"docb":fileIcon=url+"ms-word.svg";break;case"xls":case"xlt":case"xlm":case"xlsx":case"xlsm":case"xltx":case"xltm":case"xlsb":case"xla":case"xlam":case"xll":case"xlw":fileIcon=url+"ms-excel.svg";break;case"ppt":case"pot":case"pps":case"pptx":case"pptm":case"potx":case"potm":case"ppam":case"ppsx":case"ppsm":case"sldx":case"sldm":fileIcon=url+"ms-powerpoint.svg";break;case"accdb":case"accde":case"accdt":case"accdr":fileIcon=url+"ms-access.svg";break;case"mpp":case"mpt":fileIcon=url+"ms-project.svg";break;case"pst":case"ost":case"eml":fileIcon=url+"ms-outlook.svg";break;case"idea":case"ai":case"ait":case"draw":case"line":case"sket":case"dwg":case"dxf":case"cgm":case"cdr":case"eps":case"epsf":case"ps":case"psd":case"pdd":case"pxr":fileIcon=url+"adobe-cc.svg";break;case"rar":case"zip":case"7z":case"arj":case"bz2":case"cab":case"gz":case"lz":case"lzh":case"tar":case"uue":case"xz":case"z":case"zipx":case"001":fileIcon=url+"zip.svg";break;case"htm":case"html":case"shtml":case"xht":case"xhtml":case"webp":case"mht":case"mhtml":case"url":case"website":fileIcon=url+"browser.svg";break;case"exe":case"bat":case"bin":case"cmd":case"com":case"cpl":case"gadget":case"lnk":case"msc":case"smi":case"mst":case"ps1":case"reg":case"vb":case"vbs":case"vbe":case"vbscript":case"ws":fileIcon=url+"executable.svg";break;case"ttf":case"otf":case"woff":case"woff2":case"eot":fileIcon=url+"fonts.svg";break;case"pbix":fileIcon=url+"power-bi.svg";break;default:fileIcon=url+"file.svg";break}return fileIcon};Icon.prototype.extension=function(fileName){return fileName.substr(fileName.lastIndexOf(".")+1).toLowerCase()};return Icon}();exports.AttachmentIcon=new Icon;var Parser=function(){function Parser(){}Parser.prototype.parseAcceptFiles=function(accepts){return accepts.replace(/image\//g,"").replace(/x-/g,"").replace(/\+xml/g,"").replace(/ /g,"").split(",")};Parser.prototype.populateFiles=function(attachmentsData){var e_1,_a;var attachments=[];var userAttachments=attachmentsData.filter((function(x){return x.new}));try{for(var userAttachments_1=tslib_1.__values(userAttachments),userAttachments_1_1=userAttachments_1.next();!userAttachments_1_1.done;userAttachments_1_1=userAttachments_1.next()){var attachment=userAttachments_1_1.value;if(attachment.file!=null){var name_1=exports.AttachmentClean.cleanAttachmentText(attachment.file.name);var content=new Blob([attachment.file],{type:attachment.file.type});attachments.push({name:name_1,content:content})}}}catch(e_1_1){e_1={error:e_1_1}}finally{try{if(userAttachments_1_1&&!userAttachments_1_1.done&&(_a=userAttachments_1.return))_a.call(userAttachments_1)}finally{if(e_1)throw e_1.error}}return attachments};return Parser}();exports.AttachmentParser=new Parser;var Validate=function(){function Validate(){this.maxSize=function(input){var fileName=input.attributes["data-maxsize"].nodeValue;if(fileName){return parseInt(fileName,10)}else{return 1024*45}}}Validate.prototype.file=function(input,accepts){var e_2,_a;var fileName=input.value;var idxDot=fileName.lastIndexOf(".")+1;var extFile=fileName.substr(idxDot,fileName.length).toLowerCase();if(accepts.length===1&&accepts[0]==="*"){return true}try{for(var accepts_1=tslib_1.__values(accepts),accepts_1_1=accepts_1.next();!accepts_1_1.done;accepts_1_1=accepts_1.next()){var extension=accepts_1_1.value;if(extFile===extension){return true}}}catch(e_2_1){e_2={error:e_2_1}}finally{try{if(accepts_1_1&&!accepts_1_1.done&&(_a=accepts_1.return))_a.call(accepts_1)}finally{if(e_2)throw e_2.error}}return false};Validate.prototype.fileSize=function(input){if(input!=null&&input.files!=null){var fileSize=input.files[0].size/1024;var max=this.maxSize(input);return fileSize<=max}else{console.error("Input is null.");return false}};Validate.prototype.duplicated=function(fileName,attachmentList){var e_3,_a;if(attachmentList==null){console.error("You need informing the list of attachments to be compared.");return false}else{try{for(var attachmentList_1=tslib_1.__values(attachmentList),attachmentList_1_1=attachmentList_1.next();!attachmentList_1_1.done;attachmentList_1_1=attachmentList_1.next()){var file=attachmentList_1_1.value;if(file.name.toLowerCase()===fileName.toLowerCase()){return true}}}catch(e_3_1){e_3={error:e_3_1}}finally{try{if(attachmentList_1_1&&!attachmentList_1_1.done&&(_a=attachmentList_1.return))_a.call(attachmentList_1)}finally{if(e_3)throw e_3.error}}}return false};return Validate}();exports.AttachmentValidate=new Validate; | ||
"use strict";var __values=this&&this.__values||function(o){var s=typeof Symbol==="function"&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length==="number")return{next:function(){if(o&&i>=o.length)o=void 0;return{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(exports,"__esModule",{value:true});var Convert=function(){function Convert(){}Convert.prototype.textFileToUrlImage=function(file){return new Promise((function(resolve){var fileReader=new FileReader;fileReader.addEventListener("load",(function(e){resolve(e.target.result)}));fileReader.readAsDataURL(file)}))};return Convert}();exports.AttachmentConvert=new Convert;var Clean=function(){function Clean(){}Clean.prototype.cleanAttachmentText=function(string){return string.replace(/€/g,"").replace(/`/g,"").replace(/„/g,"").replace(/…/g,"").replace(/†/g,"").replace(/‡/g,"").replace(/ˆ/g,"").replace(/‰/g,"").replace(/Š/g,"").replace(/‹/g,"").replace(/Œ/g,"").replace(//g,"").replace(/Ž/g,"").replace(//g,"").replace(/‘/g,"").replace(/’/g,"").replace(/“/g,"").replace(/”/g,"").replace(/•/g,"").replace(/˜/g,"").replace(/™/g,"").replace(/š/g,"").replace(/›/g,"").replace(/œ/g,"").replace(/ž/g,"").replace(/Ÿ/g,"").replace(/¢/g,"").replace(/£/g,"").replace(/¤/g,"").replace(/¥/g,"").replace(/¦/g,"").replace(/§/g,"").replace(/¨/g,"").replace(/©/g,"").replace(/ª/g,"").replace(/«/g,"").replace(/¬/g,"").replace(/®/g,"").replace(/¯/g,"").replace(/°/g,"").replace(/±/g,"").replace(/²/g,"").replace(/³/g,"").replace(/´/g,"").replace(/µ/g,"").replace(/¶/g,"").replace(/·/g,"").replace(/¹/g,"").replace(/º/g,"").replace(/»/g,"").replace(/¼/g,"").replace(/½/g,"").replace(/¾/g,"").replace(/¿/g,"").replace(/Å/g,"A").replace(/Æ/g,"A").replace(/Ð/g,"D").replace(/Ø/g,"O").replace(/ß/g,"B").replace(/æ/g,"a").replace(/÷/g,"").replace(/ø/g,"o").replace(/þ/g,"b").replace(/!/g,"").replace(/"/g,"").replace(/#/g,"").replace(/\$/g,"").replace(/%/g,"").replace(/&/g,"").replace(/'/g,"").replace(/\(/g,"").replace(/\)/g,"").replace(/\*/g,"").replace(/\+/g,"").replace(/\//g,"").replace(/:/g,"").replace(/;/g,"").replace(/</g,"").replace(/=/g,"").replace(/>/g,"").replace(/\?/g,"").replace(/@/g,"").replace(/\[/g,"").replace(/\\/g,"").replace(/]/g,"").replace(/\^/g,"").replace(/_/g,"").replace(/`/g,"").replace(/{/g,"").replace(/\|/g,"").replace(/}/g,"").replace(/~/g,"").replace(/`/g,"").replace(//g,"").replace(/ƒ/g,"f").replace(/„/g,"").replace(/…/g,"").replace(/†/g,"").replace(/‡/g,"").replace(/ˆ/g,"").replace(/‰/g,"").replace(/Š/g,"").replace(/‹/g,"").replace(/Œ/g,"").replace(//g,"").replace(/Ž/g,"Z").replace(//g,"").replace(//g,"").replace(/‘/g,"").replace(/’/g,"").replace(/“/g,"").replace(/”/g,"").replace(/•/g,"").replace(/–/g,"").replace(/—/g,"").replace(/˜/g,"").replace(/™/g,"").replace(/š/g,"").replace(/›/g,"").replace(/œ/g,"").replace(//g,"").replace(/ž/g,"z").replace(/Ÿ/g,"Y").replace(/¡/g,"").replace(/¢/g,"c").replace(/£/g,"").replace(/¤/g,"").replace(/¥/g,"Y").replace(/¦/g,"").replace(/§/g,"").replace(/¨/g,"").replace(/©/g,"").replace(/ª/g,"").replace(/«/g,"").replace(/¬/g,"").replace(/®/g,"").replace(/¯/g,"").replace(/°/g,"").replace(/±/g,"").replace(/²/g,"2").replace(/³/g,"3").replace(/´/g,"").replace(/µ/g,"u").replace(/¶/g,"").replace(/·/g,"").replace(/¹/g,"1").replace(/º/g,"").replace(/»/g,"").replace(/¼/g,"").replace(/½/g,"").replace(/¾/g,"").replace(/¿/g,"").replace(/Ð/g,"D").replace(/ß/g,"B").replace(/æ/g,"a").replace(/÷/g,"").replace(/ø/g,"o").replace(/þ/g,"b").replace(/&/g,"").replace(/</g,"").replace(/>/g,"")};return Clean}();exports.AttachmentClean=new Clean;var Icon=function(){function Icon(){}Icon.prototype.get=function(fileName,url){if(url===void 0){url="assets/img/icon/attachment-icons/"}var extension=this.extension(fileName);var fileIcon;switch(extension.toLowerCase()){case"pdf":fileIcon=url+"adobe-pdf.svg";break;case"txt":fileIcon=url+"txt.svg";break;case"ooxml":fileIcon=url+"ms-office-365.svg";break;case"jpeg":case"jpg":case"png":case"gif":case"tiff":case"raw":case"svg":case"bmp":case"emf":case"svgz":fileIcon=url+"image-icon.svg";break;case"avi":case"flv":case"wmv":case"mov":case"mp4":case"mpeg":case"3gp":case"ogg":case"webm":case"hdv":case"vob":case"wav":fileIcon=url+"video-icon.svg";break;case"doc":case"dot":case"wbk":case"docx":case"docm":case"dotx":case"dotm":case"docb":fileIcon=url+"ms-word.svg";break;case"xls":case"xlt":case"xlm":case"xlsx":case"xlsm":case"xltx":case"xltm":case"xlsb":case"xla":case"xlam":case"xll":case"xlw":fileIcon=url+"ms-excel.svg";break;case"ppt":case"pot":case"pps":case"pptx":case"pptm":case"potx":case"potm":case"ppam":case"ppsx":case"ppsm":case"sldx":case"sldm":fileIcon=url+"ms-powerpoint.svg";break;case"accdb":case"accde":case"accdt":case"accdr":fileIcon=url+"ms-access.svg";break;case"mpp":case"mpt":fileIcon=url+"ms-project.svg";break;case"pst":case"ost":case"eml":fileIcon=url+"ms-outlook.svg";break;case"idea":case"ai":case"ait":case"draw":case"line":case"sket":case"dwg":case"dxf":case"cgm":case"cdr":case"eps":case"epsf":case"ps":case"psd":case"pdd":case"pxr":fileIcon=url+"adobe-cc.svg";break;case"rar":case"zip":case"7z":case"arj":case"bz2":case"cab":case"gz":case"lz":case"lzh":case"tar":case"uue":case"xz":case"z":case"zipx":case"001":fileIcon=url+"zip.svg";break;case"htm":case"html":case"shtml":case"xht":case"xhtml":case"webp":case"mht":case"mhtml":case"url":case"website":fileIcon=url+"browser.svg";break;case"exe":case"bat":case"bin":case"cmd":case"com":case"cpl":case"gadget":case"lnk":case"msc":case"smi":case"mst":case"ps1":case"reg":case"vb":case"vbs":case"vbe":case"vbscript":case"ws":fileIcon=url+"executable.svg";break;case"ttf":case"otf":case"woff":case"woff2":case"eot":fileIcon=url+"fonts.svg";break;case"pbix":fileIcon=url+"power-bi.svg";break;default:fileIcon=url+"file.svg";break}return fileIcon};Icon.prototype.extension=function(fileName){return fileName.substr(fileName.lastIndexOf(".")+1).toLowerCase()};return Icon}();exports.AttachmentIcon=new Icon;var Parser=function(){function Parser(){}Parser.prototype.parseAcceptFiles=function(accepts){return accepts.replace(/image\//g,"").replace(/x-/g,"").replace(/\+xml/g,"").replace(/ /g,"").split(",")};Parser.prototype.populateFiles=function(attachmentsData){var e_1,_a;var attachments=[];var userAttachments=attachmentsData.filter((function(x){return x.new}));try{for(var userAttachments_1=__values(userAttachments),userAttachments_1_1=userAttachments_1.next();!userAttachments_1_1.done;userAttachments_1_1=userAttachments_1.next()){var attachment=userAttachments_1_1.value;if(attachment.file!=null){var name_1=exports.AttachmentClean.cleanAttachmentText(attachment.file.name);var content=new Blob([attachment.file],{type:attachment.file.type});attachments.push({name:name_1,content:content})}}}catch(e_1_1){e_1={error:e_1_1}}finally{try{if(userAttachments_1_1&&!userAttachments_1_1.done&&(_a=userAttachments_1.return))_a.call(userAttachments_1)}finally{if(e_1)throw e_1.error}}return attachments};return Parser}();exports.AttachmentParser=new Parser;var Validate=function(){function Validate(){this.maxSize=function(input){var fileName=input.attributes["data-maxsize"].nodeValue;if(fileName){return parseInt(fileName,10)}else{return 1024*45}}}Validate.prototype.file=function(input,accepts){var e_2,_a;var fileName=input.value;var idxDot=fileName.lastIndexOf(".")+1;var extFile=fileName.substr(idxDot,fileName.length).toLowerCase();if(accepts.length===1&&accepts[0]==="*"){return true}try{for(var accepts_1=__values(accepts),accepts_1_1=accepts_1.next();!accepts_1_1.done;accepts_1_1=accepts_1.next()){var extension=accepts_1_1.value;if(extFile===extension){return true}}}catch(e_2_1){e_2={error:e_2_1}}finally{try{if(accepts_1_1&&!accepts_1_1.done&&(_a=accepts_1.return))_a.call(accepts_1)}finally{if(e_2)throw e_2.error}}return false};Validate.prototype.fileSize=function(input){if(input!=null&&input.files!=null){var fileSize=input.files[0].size/1024;var max=this.maxSize(input);return fileSize<=max}else{console.error("Input is null.");return false}};Validate.prototype.duplicated=function(fileName,attachmentList){var e_3,_a;if(attachmentList==null){console.error("You need informing the list of attachments to be compared.");return false}else{try{for(var attachmentList_1=__values(attachmentList),attachmentList_1_1=attachmentList_1.next();!attachmentList_1_1.done;attachmentList_1_1=attachmentList_1.next()){var file=attachmentList_1_1.value;if(file.name.toLowerCase()===fileName.toLowerCase()){return true}}}catch(e_3_1){e_3={error:e_3_1}}finally{try{if(attachmentList_1_1&&!attachmentList_1_1.done&&(_a=attachmentList_1.return))_a.call(attachmentList_1)}finally{if(e_3)throw e_3.error}}}return false};return Validate}();exports.AttachmentValidate=new Validate; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var tslib_1=require("tslib");var $=require("jquery");var moment=require("moment");var moment_range_1=require("moment-range");var core_services_string_service_1=require("../string/core-services-string.service");var Get=function(){function Get(){}Get.prototype.customDate=function(date,format){return moment(date).format(format)};Get.prototype.currentDate=function(outputFormat){if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(new Date,outputFormat).local().format(outputFormat)};Get.prototype.dayMonthYear=function(date,format){if(format===void 0){format="DD/MM/YYYY"}var x=moment(date,format,true).format(format);var d=parseInt(x.split("/")[0],10);var m=parseInt(x.split("/")[1],10)-1;var y=parseInt(x.split("/")[2],10);return{day:d,month:m,year:y}};Get.prototype.localDate=function(year,month,day,local){if(local===void 0){local="pt-BR"}var options={year:"numeric",month:"numeric",day:"numeric"};return new Date(year,month,day).toLocaleDateString(local,options)};Get.prototype.dateFromIso=function(date,format){if(format===void 0){format="DD/MM/YYYY"}return moment.utc(date).format(format)};Get.prototype.ganttDate=function(date){var splitDate=this.dayMonthYear(date);return new Date(splitDate.year,splitDate.month,splitDate.day)};Get.prototype.isoDateCustom=function(date,dateFormat,outputFormat){var splitDate=this.dayMonthYear(date);return new Date(splitDate.year,splitDate.month,splitDate.day).toISOString()};Get.prototype.isoDate=function(date,format){if(format===void 0){format="DD/MM/YYYY"}return moment.utc(date,format).format(format)};Get.prototype.isoDateWithoutTime=function(date){var splitDate=this.dayMonthYear(date);return moment.utc(new Date(splitDate.year,splitDate.month,splitDate.day)).toISOString()};Get.prototype.dateMilliseconds=function(date,dateFormat,outputFormat){return+moment(this.isoDateCustom(date,dateFormat,outputFormat),dateFormat).format("x")};Get.prototype.dateToMillisecondsNoTime=function(date){return+moment(this.isoDateWithoutTime(date)).format("x")};Get.prototype.millisecondsToDate=function(date,outputFormat){return moment.utc(date,"x").format(outputFormat)};Get.prototype.daysToMilliseconds=function(days){return days*24*60*60*1e3};Get.prototype.durationInDays=function(start,end,countFirstDay){var s=this.dayMonthYear(start);var e=this.dayMonthYear(end);var startDate=moment([s.year,s.month,s.day]);var endDate=moment([e.year,e.month,e.day]);var difference=endDate.diff(startDate,"days");var additional=countFirstDay?1:0;return difference+additional};Get.prototype.durationInMilliseconds=function(start,end){return this.daysToMilliseconds(this.durationInDays(start,end,false))};Get.prototype.monthName=function(month,language){if(language===void 0){language="pt-br"}if(language==="pt-br"||language==="pt-pt"||language==="pt"){switch(month){case 0:return"Janeiro";case 1:return"Fevereiro";case 2:return"Março";case 3:return"Abril";case 4:return"Maio";case 5:return"Junho";case 6:return"Julho";case 7:return"Agosto";case 8:return"Setembro";case 9:return"Outubro";case 10:return"Novembro";case 11:return"Dezembro";default:return""}}else{switch(month){case 0:return"January";case 1:return"February";case 2:return"March";case 3:return"April";case 4:return"May";case 5:return"June";case 6:return"July";case 7:return"August";case 8:return"September";case 9:return"October";case 10:return"November";case 11:return"December";default:return""}}};Get.prototype.weeksOfMonth=function(year,month){var e_1,_a,e_2,_b;var _moment=moment_range_1.extendMoment(moment);var startDate=moment([year,month]);var firstDay=moment(startDate).startOf("month");var endDay=moment(startDate).endOf("month");var monthRange=_moment.range(firstDay,endDay);var weeks=[];var _loop_1=function(range){var contain=weeks.filter((function(x){return x===range.week()})).length>0;if(!contain){weeks.push(range.week())}};try{for(var _c=tslib_1.__values(monthRange.by("days")),_d=_c.next();!_d.done;_d=_c.next()){var range=_d.value;_loop_1(range)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{if(_d&&!_d.done&&(_a=_c.return))_a.call(_c)}finally{if(e_1)throw e_1.error}}var calendar=[];try{for(var weeks_1=tslib_1.__values(weeks),weeks_1_1=weeks_1.next();!weeks_1_1.done;weeks_1_1=weeks_1.next()){var week=weeks_1_1.value;var firstWeekDay=void 0;var lastWeekDay=void 0;var weekRange=void 0;if(month===11&&week===1){firstWeekDay=moment(year+1,"YYYY").week(week).day(0).isAfter(firstDay)?moment(year+1,"YYYY").week(week).day(0):firstDay;lastWeekDay=moment(year+1,"YYYY").week(week).day(6).isBefore(endDay)?moment(year+1,"YYYY").week(week).day(6):endDay;weekRange=_moment.range(firstWeekDay,lastWeekDay)}else{firstWeekDay=moment().week(week).day(0).isAfter(firstDay)?moment().week(week).day(0):firstDay;lastWeekDay=moment().week(week).day(6).isBefore(endDay)?moment().week(week).day(6):endDay;weekRange=_moment.range(firstWeekDay,lastWeekDay)}calendar.push({week:week,start:moment(weekRange.start.toISOString()).format("DD/MM/YYYY"),startDay:moment(weekRange.start.toISOString()).format("DD"),startMonth:moment(weekRange.start.toISOString()).format("MM"),startYear:moment(weekRange.start.toISOString()).format("YYYY"),end:moment(weekRange.end.toISOString()).format("DD/MM/YYYY"),endDay:moment(weekRange.end.toISOString()).format("DD"),endMonth:moment(weekRange.end.toISOString()).format("MM"),endYear:moment(weekRange.end.toISOString()).format("YYYY")})}}catch(e_2_1){e_2={error:e_2_1}}finally{try{if(weeks_1_1&&!weeks_1_1.done&&(_b=weeks_1.return))_b.call(weeks_1)}finally{if(e_2)throw e_2.error}}return calendar};Get.prototype.daysOfMonth=function(weeksRange){var e_3,_a;var range=[];try{for(var _b=tslib_1.__values(weeksRange.entries()),_c=_b.next();!_c.done;_c=_b.next()){var _d=tslib_1.__read(_c.value,2),i=_d[0],week=_d[1];var start=parseInt(weeksRange[i].startDay,10);var end=parseInt(weeksRange[i].endDay,10);var month=weeksRange[i].startMonth;var year=weeksRange[i].startYear;var weekDays=[];for(var j=start;j<=end;j++){var day=core_services_string_service_1.StringConverter.numberToString(j);weekDays.push({week:week.week,day:day,month:""+month,year:""+year,dayMonth:day+"/"+month,date:day+"/"+month+"/"+year,monthYear:month+"/"+year})}range.push(weekDays)}}catch(e_3_1){e_3={error:e_3_1}}finally{try{if(_c&&!_c.done&&(_a=_b.return))_a.call(_b)}finally{if(e_3)throw e_3.error}}return range};Get.prototype.weekOfYear=function(date,format){return moment(date,format).week()};return Get}();exports.DateGet=new Get;var Comparable=function(){function Comparable(){}Comparable.prototype.isDateBefore=function(startDate,endDate,type){if(type===void 0){type="day"}return moment(endDate).isBefore(startDate,type)};return Comparable}();exports.DateComparable=new Comparable;var Validation=function(){function Validation(){}Validation.prototype.date=function(date){var aDate=moment(date,"DD/MM/YYYY",true);return aDate.isValid()};return Validation}();exports.DateValidation=new Validation;var Picker=function(){function Picker(){}Picker.prototype.setDatePicker=function(datePicker,dateFormat){$(datePicker).datepicker("option","dateFormat",dateFormat)};Picker.prototype.monthYearDatePicker=function(datePicker,dateFormat,setValueCallback){$(datePicker).datepicker({changeMonth:true,changeYear:true,showButtonPanel:true,dateFormat:dateFormat,showAnim:"drop",showOn:"button",buttonImage:"assets/img/icon/calendar.svg",buttonImageOnly:true,buttonText:"Select period",onClose:function(){var _month=$("#ui-datepicker-div .ui-datepicker-month :selected").val();var _year=$("#ui-datepicker-div .ui-datepicker-year :selected").val();$(this).datepicker("setDate",new Date(_year,_month,1));setValueCallback(datePicker.value);setTimeout((function(){var parentCalendar=document.querySelector("#ui-datepicker-div");parentCalendar.classList.remove("only-month-year")}),500)},beforeShow:function(){var parentCalendar=document.querySelector("#ui-datepicker-div");parentCalendar.classList.add("only-month-year");var selDate=$(this).val();if(selDate.length>0){var _year=parseInt(selDate.substring(selDate.length-4,selDate.length),10);var _month=parseInt(selDate.substring(0,selDate.length-5),10)-1;$(this).datepicker("option","defaultDate",new Date(_year,_month,1));$(this).datepicker("setDate",new Date(_year,_month,1));console.log(_year);console.log(_month)}}})};Picker.prototype.dateFromDatePicker=function(date,format,outputFormat){if(format===void 0){format="DD/MM/YYYY"}if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment(date,format).format(outputFormat)};Picker.prototype.localDateForDatePicker=function(date,outputFormat){if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(date,outputFormat).local().format(outputFormat)};Picker.prototype.currentDateForDatePicker=function(dateFormat,outputFormat){if(dateFormat===void 0){dateFormat="DD/MM/YYYY"}if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(new Date,"DD/MM/YYYY").format(outputFormat)};Picker.prototype.dateForDatePicker=function(month,day,year){var x=moment(new Date(year,month,day),"DD/MM/YYYY",true).toISOString().split("T")[0];x=x.split("-")[2]+"/"+x.split("-")[1]+"/"+x.split("-")[0];return x};return Picker}();exports.DatePicker=new Picker; | ||
"use strict";var __values=this&&this.__values||function(o){var s=typeof Symbol==="function"&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length==="number")return{next:function(){if(o&&i>=o.length)o=void 0;return{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")};var __read=this&&this.__read||function(o,n){var m=typeof Symbol==="function"&&o[Symbol.iterator];if(!m)return o;var i=m.call(o),r,ar=[],e;try{while((n===void 0||n-- >0)&&!(r=i.next()).done)ar.push(r.value)}catch(error){e={error:error}}finally{try{if(r&&!r.done&&(m=i["return"]))m.call(i)}finally{if(e)throw e.error}}return ar};Object.defineProperty(exports,"__esModule",{value:true});var $=require("jquery");var moment=require("moment");var moment_range_1=require("moment-range");var core_services_string_service_1=require("../string/core-services-string.service");var Get=function(){function Get(){}Get.prototype.customDate=function(date,format){return moment(date).format(format)};Get.prototype.currentDate=function(outputFormat){if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(new Date,outputFormat).local().format(outputFormat)};Get.prototype.dayMonthYear=function(date,format){if(format===void 0){format="DD/MM/YYYY"}var x=moment(date,format,true).format(format);var d=parseInt(x.split("/")[0],10);var m=parseInt(x.split("/")[1],10)-1;var y=parseInt(x.split("/")[2],10);return{day:d,month:m,year:y}};Get.prototype.localDate=function(year,month,day,local){if(local===void 0){local="pt-BR"}var options={year:"numeric",month:"numeric",day:"numeric"};return new Date(year,month,day).toLocaleDateString(local,options)};Get.prototype.dateFromIso=function(date,format){if(format===void 0){format="DD/MM/YYYY"}return moment.utc(date).format(format)};Get.prototype.ganttDate=function(date){var splitDate=this.dayMonthYear(date);return new Date(splitDate.year,splitDate.month,splitDate.day)};Get.prototype.isoDateCustom=function(date,dateFormat,outputFormat){var splitDate=this.dayMonthYear(date);return new Date(splitDate.year,splitDate.month,splitDate.day).toISOString()};Get.prototype.isoDate=function(date,format){if(format===void 0){format="DD/MM/YYYY"}return moment.utc(date,format).format(format)};Get.prototype.isoDateWithoutTime=function(date){var splitDate=this.dayMonthYear(date);return moment.utc(new Date(splitDate.year,splitDate.month,splitDate.day)).toISOString()};Get.prototype.dateMilliseconds=function(date,dateFormat,outputFormat){return+moment(this.isoDateCustom(date,dateFormat,outputFormat),dateFormat).format("x")};Get.prototype.dateToMillisecondsNoTime=function(date){return+moment(this.isoDateWithoutTime(date)).format("x")};Get.prototype.millisecondsToDate=function(date,outputFormat){return moment.utc(date,"x").format(outputFormat)};Get.prototype.daysToMilliseconds=function(days){return days*24*60*60*1e3};Get.prototype.durationInDays=function(start,end,countFirstDay){var s=this.dayMonthYear(start);var e=this.dayMonthYear(end);var startDate=moment([s.year,s.month,s.day]);var endDate=moment([e.year,e.month,e.day]);var difference=endDate.diff(startDate,"days");var additional=countFirstDay?1:0;return difference+additional};Get.prototype.durationInMilliseconds=function(start,end){return this.daysToMilliseconds(this.durationInDays(start,end,false))};Get.prototype.monthName=function(month,language){if(language===void 0){language="pt-br"}if(language==="pt-br"||language==="pt-pt"||language==="pt"){switch(month){case 0:return"Janeiro";case 1:return"Fevereiro";case 2:return"Março";case 3:return"Abril";case 4:return"Maio";case 5:return"Junho";case 6:return"Julho";case 7:return"Agosto";case 8:return"Setembro";case 9:return"Outubro";case 10:return"Novembro";case 11:return"Dezembro";default:return""}}else{switch(month){case 0:return"January";case 1:return"February";case 2:return"March";case 3:return"April";case 4:return"May";case 5:return"June";case 6:return"July";case 7:return"August";case 8:return"September";case 9:return"October";case 10:return"November";case 11:return"December";default:return""}}};Get.prototype.weeksOfMonth=function(year,month){var e_1,_a,e_2,_b;var _moment=moment_range_1.extendMoment(moment);var startDate=moment([year,month]);var firstDay=moment(startDate).startOf("month");var endDay=moment(startDate).endOf("month");var monthRange=_moment.range(firstDay,endDay);var weeks=[];var _loop_1=function(range){var contain=weeks.filter((function(x){return x===range.week()})).length>0;if(!contain){weeks.push(range.week())}};try{for(var _c=__values(monthRange.by("days")),_d=_c.next();!_d.done;_d=_c.next()){var range=_d.value;_loop_1(range)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{if(_d&&!_d.done&&(_a=_c.return))_a.call(_c)}finally{if(e_1)throw e_1.error}}var calendar=[];try{for(var weeks_1=__values(weeks),weeks_1_1=weeks_1.next();!weeks_1_1.done;weeks_1_1=weeks_1.next()){var week=weeks_1_1.value;var firstWeekDay=void 0;var lastWeekDay=void 0;var weekRange=void 0;if(month===11&&week===1){firstWeekDay=moment(year+1,"YYYY").week(week).day(0).isAfter(firstDay)?moment(year+1,"YYYY").week(week).day(0):firstDay;lastWeekDay=moment(year+1,"YYYY").week(week).day(6).isBefore(endDay)?moment(year+1,"YYYY").week(week).day(6):endDay;weekRange=_moment.range(firstWeekDay,lastWeekDay)}else{firstWeekDay=moment().week(week).day(0).isAfter(firstDay)?moment().week(week).day(0):firstDay;lastWeekDay=moment().week(week).day(6).isBefore(endDay)?moment().week(week).day(6):endDay;weekRange=_moment.range(firstWeekDay,lastWeekDay)}calendar.push({week:week,start:moment(weekRange.start.toISOString()).format("DD/MM/YYYY"),startDay:moment(weekRange.start.toISOString()).format("DD"),startMonth:moment(weekRange.start.toISOString()).format("MM"),startYear:moment(weekRange.start.toISOString()).format("YYYY"),end:moment(weekRange.end.toISOString()).format("DD/MM/YYYY"),endDay:moment(weekRange.end.toISOString()).format("DD"),endMonth:moment(weekRange.end.toISOString()).format("MM"),endYear:moment(weekRange.end.toISOString()).format("YYYY")})}}catch(e_2_1){e_2={error:e_2_1}}finally{try{if(weeks_1_1&&!weeks_1_1.done&&(_b=weeks_1.return))_b.call(weeks_1)}finally{if(e_2)throw e_2.error}}return calendar};Get.prototype.daysOfMonth=function(weeksRange){var e_3,_a;var range=[];try{for(var _b=__values(weeksRange.entries()),_c=_b.next();!_c.done;_c=_b.next()){var _d=__read(_c.value,2),i=_d[0],week=_d[1];var start=parseInt(weeksRange[i].startDay,10);var end=parseInt(weeksRange[i].endDay,10);var month=weeksRange[i].startMonth;var year=weeksRange[i].startYear;var weekDays=[];for(var j=start;j<=end;j++){var day=core_services_string_service_1.StringConverter.numberToString(j);weekDays.push({week:week.week,day:day,month:""+month,year:""+year,dayMonth:day+"/"+month,date:day+"/"+month+"/"+year,monthYear:month+"/"+year})}range.push(weekDays)}}catch(e_3_1){e_3={error:e_3_1}}finally{try{if(_c&&!_c.done&&(_a=_b.return))_a.call(_b)}finally{if(e_3)throw e_3.error}}return range};Get.prototype.weekOfYear=function(date,format){return moment(date,format).week()};return Get}();exports.DateGet=new Get;var Comparable=function(){function Comparable(){}Comparable.prototype.isDateBefore=function(startDate,endDate,type){if(type===void 0){type="day"}return moment(endDate).isBefore(startDate,type)};return Comparable}();exports.DateComparable=new Comparable;var Validation=function(){function Validation(){}Validation.prototype.date=function(date){var aDate=moment(date,"DD/MM/YYYY",true);return aDate.isValid()};return Validation}();exports.DateValidation=new Validation;var Picker=function(){function Picker(){}Picker.prototype.setDatePicker=function(datePicker,dateFormat){$(datePicker).datepicker("option","dateFormat",dateFormat)};Picker.prototype.monthYearDatePicker=function(datePicker,dateFormat,setValueCallback){$(datePicker).datepicker({changeMonth:true,changeYear:true,showButtonPanel:true,dateFormat:dateFormat,showAnim:"drop",showOn:"button",buttonImage:"assets/img/icon/calendar.svg",buttonImageOnly:true,buttonText:"Select period",onClose:function(){var _month=$("#ui-datepicker-div .ui-datepicker-month :selected").val();var _year=$("#ui-datepicker-div .ui-datepicker-year :selected").val();$(this).datepicker("setDate",new Date(_year,_month,1));setValueCallback(datePicker.value);setTimeout((function(){var parentCalendar=document.querySelector("#ui-datepicker-div");parentCalendar.classList.remove("only-month-year")}),500)},beforeShow:function(){var parentCalendar=document.querySelector("#ui-datepicker-div");parentCalendar.classList.add("only-month-year");var selDate=$(this).val();if(selDate.length>0){var _year=parseInt(selDate.substring(selDate.length-4,selDate.length),10);var _month=parseInt(selDate.substring(0,selDate.length-5),10)-1;$(this).datepicker("option","defaultDate",new Date(_year,_month,1));$(this).datepicker("setDate",new Date(_year,_month,1));console.log(_year);console.log(_month)}}})};Picker.prototype.dateFromDatePicker=function(date,format,outputFormat){if(format===void 0){format="DD/MM/YYYY"}if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment(date,format).format(outputFormat)};Picker.prototype.localDateForDatePicker=function(date,outputFormat){if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(date,outputFormat).local().format(outputFormat)};Picker.prototype.currentDateForDatePicker=function(dateFormat,outputFormat){if(dateFormat===void 0){dateFormat="DD/MM/YYYY"}if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(new Date,"DD/MM/YYYY").format(outputFormat)};Picker.prototype.dateForDatePicker=function(month,day,year){var x=moment(new Date(year,month,day),"DD/MM/YYYY",true).toISOString().split("T")[0];x=x.split("-")[2]+"/"+x.split("-")[1]+"/"+x.split("-")[0];return x};return Picker}();exports.DatePicker=new Picker; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var tslib_1=require("tslib");var rxjs_1=require("rxjs");var Excel=require("xlsx");var XlsxPopulate=require("xlsx-populate/browser/xlsx-populate.min.js");var core_services_browser_service_1=require("../../../core/services/browser/core-services-browser.service");var core_services_date_service_1=require("../../../core/services/date/core-services-date.service");var Core=function(){function Core(){this.status$=new rxjs_1.Subject}Core.headerAndContent=function(workbook,sheetName,header,content,width,style,addSheet){var e_1,_a;if(width===void 0){width=null}if(style===void 0){style={}}if(addSheet===void 0){addSheet=true}var headerStyle={fill:"64666C",fontColor:"FFFFFF",horizontalAlignment:"center"};if(addSheet){workbook.addSheet(sheetName)}workbook.sheet(sheetName).cell("A1").value(content);try{for(var _b=tslib_1.__values(header.entries()),_c=_b.next();!_c.done;_c=_b.next()){var _d=tslib_1.__read(_c.value,2),i=_d[0],h=_d[1];var _h=h.length==null?50:h.length;var _width=width==null?_h:width;workbook.sheet(sheetName).row(1).cell(i+1).style(headerStyle);workbook.sheet(sheetName).column(i+1).width(1.5*_width).style(style)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{if(_c&&!_c.done&&(_a=_b.return))_a.call(_b)}finally{if(e_1)throw e_1.error}}};Core.parseDatabaseData=function(workbook,dataArray,sheetName,addSheet){var e_2,_a,e_3,_b,e_4,_c;var _header=[];var _content=[];if(!addSheet){workbook.sheet(0).name(sheetName)}try{for(var _d=tslib_1.__values(Object.keys(dataArray[0])),_e=_d.next();!_e.done;_e=_d.next()){var key=_e.value;_header.push(key)}}catch(e_2_1){e_2={error:e_2_1}}finally{try{if(_e&&!_e.done&&(_a=_d.return))_a.call(_d)}finally{if(e_2)throw e_2.error}}var temp=[];try{for(var dataArray_1=tslib_1.__values(dataArray),dataArray_1_1=dataArray_1.next();!dataArray_1_1.done;dataArray_1_1=dataArray_1.next()){var d=dataArray_1_1.value;try{for(var _header_1=(e_4=void 0,tslib_1.__values(_header)),_header_1_1=_header_1.next();!_header_1_1.done;_header_1_1=_header_1.next()){var h=_header_1_1.value;temp.push(d[h])}}catch(e_4_1){e_4={error:e_4_1}}finally{try{if(_header_1_1&&!_header_1_1.done&&(_c=_header_1.return))_c.call(_header_1)}finally{if(e_4)throw e_4.error}}_content.push(temp);temp=[]}}catch(e_3_1){e_3={error:e_3_1}}finally{try{if(dataArray_1_1&&!dataArray_1_1.done&&(_b=dataArray_1.return))_b.call(dataArray_1)}finally{if(e_3)throw e_3.error}}_content.unshift(_header);Core.headerAndContent(workbook,sheetName,_header,_content,null,{},addSheet)};Core.saveFileIE=function(content,sheetName,_fileName){if(_fileName===void 0){_fileName=null}return tslib_1.__awaiter(this,void 0,void 0,(function(){var currentDate,fileName,fileNameWidthDate,ws,wb;return tslib_1.__generator(this,(function(_a){switch(_a.label){case 0:currentDate=core_services_date_service_1.DateGet.customDate((new Date).toISOString(),"YYYYMMDD_HHMMss");fileName=_fileName==null?"Export "+currentDate:""+_fileName;fileNameWidthDate=fileName+" "+currentDate+".xlsx";ws=Excel.utils.json_to_sheet(content);wb=Excel.utils.book_new();Excel.utils.book_append_sheet(wb,ws,sheetName);return[4,Excel.writeFile(wb,fileNameWidthDate,{cellStyles:true})];case 1:_a.sent();return[2,{code:200,message:"File saved successfully"}]}}))}))};Core.prototype.saveFile=function(workbook,_fileName){if(_fileName===void 0){_fileName=null}return new Promise((function(resolve,reject){workbook.outputAsync().then((function(blob){var currentDate=core_services_date_service_1.DateGet.customDate((new Date).toISOString(),"YYYYMMDD_HHMMss");var fileName=_fileName==null?"Template RDA "+currentDate+".xlsx":_fileName+" "+currentDate+".xlsx";if(window.navigator&&window.navigator.msSaveOrOpenBlob){window.navigator.msSaveOrOpenBlob(blob,fileName)}else{var url=window.URL.createObjectURL(blob);var a=document.createElement("a");document.body.appendChild(a);a.href=url;a.download=fileName;a.click();window.URL.revokeObjectURL(url);document.body.removeChild(a)}resolve({code:200,message:"File saved successfully"})})).catch((function(reason){reject(reason)}))}))};Core.prototype.exportDatabase=function(userData,sheetName,fileName,firstSheet){var _this=this;if(firstSheet===void 0){firstSheet=true}this.status$.next("Criando planilha do Excel...");return new Promise((function(resolve){return tslib_1.__awaiter(_this,void 0,void 0,(function(){var result;var _this=this;return tslib_1.__generator(this,(function(_a){switch(_a.label){case 0:if(!core_services_browser_service_1.BrowserVersion.isBeforeIE11())return[3,2];return[4,Core.saveFileIE(userData,sheetName,fileName)];case 1:result=_a.sent();this.status$.next(result.message);if(result.code===200){resolve(result.message)}else{throw new Error(result.message)}return[3,3];case 2:XlsxPopulate.fromBlankAsync().then((function(workbook){return tslib_1.__awaiter(_this,void 0,void 0,(function(){var result;return tslib_1.__generator(this,(function(_a){switch(_a.label){case 0:Core.parseDatabaseData(workbook,userData,sheetName,!firstSheet);return[4,this.saveFile(workbook,fileName)];case 1:result=_a.sent();if(result.code===200){resolve(result.message)}else{throw new Error(result.message)}return[2]}}))}))})).catch((function(error){throw new Error("Não foi possível criar o template. Erro: "+error.message)})).finally((function(){_this.clearSubject()}));_a.label=3;case 3:return[2]}}))}))}))};Core.prototype.clearSubject=function(){this.status$.observers.map((function(x){return x.complete()}))};return Core}();exports.ExportExcelCore=new Core; | ||
"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P((function(resolve){resolve(value)}))}return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};var __values=this&&this.__values||function(o){var s=typeof Symbol==="function"&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length==="number")return{next:function(){if(o&&i>=o.length)o=void 0;return{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")};var __read=this&&this.__read||function(o,n){var m=typeof Symbol==="function"&&o[Symbol.iterator];if(!m)return o;var i=m.call(o),r,ar=[],e;try{while((n===void 0||n-- >0)&&!(r=i.next()).done)ar.push(r.value)}catch(error){e={error:error}}finally{try{if(r&&!r.done&&(m=i["return"]))m.call(i)}finally{if(e)throw e.error}}return ar};Object.defineProperty(exports,"__esModule",{value:true});var rxjs_1=require("rxjs");var Excel=require("xlsx");var XlsxPopulate=require("xlsx-populate/browser/xlsx-populate.min.js");var core_services_browser_service_1=require("../../../core/services/browser/core-services-browser.service");var core_services_date_service_1=require("../../../core/services/date/core-services-date.service");var Core=function(){function Core(){this.status$=new rxjs_1.Subject}Core.headerAndContent=function(workbook,sheetName,header,content,width,style,addSheet){var e_1,_a;if(width===void 0){width=null}if(style===void 0){style={}}if(addSheet===void 0){addSheet=true}var headerStyle={fill:"64666C",fontColor:"FFFFFF",horizontalAlignment:"center"};if(addSheet){workbook.addSheet(sheetName)}workbook.sheet(sheetName).cell("A1").value(content);try{for(var _b=__values(header.entries()),_c=_b.next();!_c.done;_c=_b.next()){var _d=__read(_c.value,2),i=_d[0],h=_d[1];var _h=h.length==null?50:h.length;var _width=width==null?_h:width;workbook.sheet(sheetName).row(1).cell(i+1).style(headerStyle);workbook.sheet(sheetName).column(i+1).width(1.5*_width).style(style)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{if(_c&&!_c.done&&(_a=_b.return))_a.call(_b)}finally{if(e_1)throw e_1.error}}};Core.parseDatabaseData=function(workbook,dataArray,sheetName,addSheet){var e_2,_a,e_3,_b,e_4,_c;var _header=[];var _content=[];if(!addSheet){workbook.sheet(0).name(sheetName)}try{for(var _d=__values(Object.keys(dataArray[0])),_e=_d.next();!_e.done;_e=_d.next()){var key=_e.value;_header.push(key)}}catch(e_2_1){e_2={error:e_2_1}}finally{try{if(_e&&!_e.done&&(_a=_d.return))_a.call(_d)}finally{if(e_2)throw e_2.error}}var temp=[];try{for(var dataArray_1=__values(dataArray),dataArray_1_1=dataArray_1.next();!dataArray_1_1.done;dataArray_1_1=dataArray_1.next()){var d=dataArray_1_1.value;try{for(var _header_1=(e_4=void 0,__values(_header)),_header_1_1=_header_1.next();!_header_1_1.done;_header_1_1=_header_1.next()){var h=_header_1_1.value;temp.push(d[h])}}catch(e_4_1){e_4={error:e_4_1}}finally{try{if(_header_1_1&&!_header_1_1.done&&(_c=_header_1.return))_c.call(_header_1)}finally{if(e_4)throw e_4.error}}_content.push(temp);temp=[]}}catch(e_3_1){e_3={error:e_3_1}}finally{try{if(dataArray_1_1&&!dataArray_1_1.done&&(_b=dataArray_1.return))_b.call(dataArray_1)}finally{if(e_3)throw e_3.error}}_content.unshift(_header);Core.headerAndContent(workbook,sheetName,_header,_content,null,{},addSheet)};Core.saveFileIE=function(content,sheetName,_fileName){if(_fileName===void 0){_fileName=null}return __awaiter(this,void 0,void 0,(function(){var currentDate,fileName,fileNameWidthDate,ws,wb;return __generator(this,(function(_a){switch(_a.label){case 0:currentDate=core_services_date_service_1.DateGet.customDate((new Date).toISOString(),"YYYYMMDD_HHMMss");fileName=_fileName==null?"Export "+currentDate:""+_fileName;fileNameWidthDate=fileName+" "+currentDate+".xlsx";ws=Excel.utils.json_to_sheet(content);wb=Excel.utils.book_new();Excel.utils.book_append_sheet(wb,ws,sheetName);return[4,Excel.writeFile(wb,fileNameWidthDate,{cellStyles:true})];case 1:_a.sent();return[2,{code:200,message:"File saved successfully"}]}}))}))};Core.prototype.saveFile=function(workbook,_fileName){if(_fileName===void 0){_fileName=null}return new Promise((function(resolve,reject){workbook.outputAsync().then((function(blob){var currentDate=core_services_date_service_1.DateGet.customDate((new Date).toISOString(),"YYYYMMDD_HHMMss");var fileName=_fileName==null?"Template RDA "+currentDate+".xlsx":_fileName+" "+currentDate+".xlsx";if(window.navigator&&window.navigator.msSaveOrOpenBlob){window.navigator.msSaveOrOpenBlob(blob,fileName)}else{var url=window.URL.createObjectURL(blob);var a=document.createElement("a");document.body.appendChild(a);a.href=url;a.download=fileName;a.click();window.URL.revokeObjectURL(url);document.body.removeChild(a)}resolve({code:200,message:"File saved successfully"})})).catch((function(reason){reject(reason)}))}))};Core.prototype.exportDatabase=function(userData,sheetName,fileName,firstSheet){var _this=this;if(firstSheet===void 0){firstSheet=true}this.status$.next("Criando planilha do Excel...");return new Promise((function(resolve){return __awaiter(_this,void 0,void 0,(function(){var result;var _this=this;return __generator(this,(function(_a){switch(_a.label){case 0:if(!core_services_browser_service_1.BrowserVersion.isBeforeIE11())return[3,2];return[4,Core.saveFileIE(userData,sheetName,fileName)];case 1:result=_a.sent();this.status$.next(result.message);if(result.code===200){resolve(result.message)}else{throw new Error(result.message)}return[3,3];case 2:XlsxPopulate.fromBlankAsync().then((function(workbook){return __awaiter(_this,void 0,void 0,(function(){var result;return __generator(this,(function(_a){switch(_a.label){case 0:Core.parseDatabaseData(workbook,userData,sheetName,!firstSheet);return[4,this.saveFile(workbook,fileName)];case 1:result=_a.sent();if(result.code===200){resolve(result.message)}else{throw new Error(result.message)}return[2]}}))}))})).catch((function(error){throw new Error("Não foi possível criar o template. Erro: "+error.message)})).finally((function(){_this.clearSubject()}));_a.label=3;case 3:return[2]}}))}))}))};Core.prototype.clearSubject=function(){this.status$.observers.map((function(x){return x.complete()}))};return Core}();exports.ExportExcelCore=new Core; |
{ | ||
"name": "gl-w-frontend", | ||
"version": "1.4.15-alpha", | ||
"version": "1.4.15-alpha2", | ||
"description": "Common code for using among web front-end development such as pure JavaScript, ES6+ and TypeScript", | ||
@@ -50,3 +50,2 @@ "main": "lib/index.js", | ||
"screenfull": "^5.0.2", | ||
"tslib": "^2.0.0", | ||
"xlsx": "^0.16.1", | ||
@@ -53,0 +52,0 @@ "xlsx-populate": "^1.21.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
271005
9
10
- Removedtslib@^2.0.0
- Removedtslib@2.8.1(transitive)