@main-class/componentes 1.20.4 → 1.21.0

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.
Files changed (40) hide show
  1. package/bundles/main-class-componentes-core.umd.js +3 -9
  2. package/bundles/main-class-componentes-core.umd.js.map +1 -1
  3. package/bundles/main-class-componentes-core.umd.min.js +1 -1
  4. package/bundles/main-class-componentes-core.umd.min.js.map +1 -1
  5. package/bundles/main-class-componentes-dialog.umd.js +2 -2
  6. package/bundles/main-class-componentes-dialog.umd.js.map +1 -1
  7. package/bundles/main-class-componentes-dialog.umd.min.js +1 -1
  8. package/bundles/main-class-componentes-dialog.umd.min.js.map +1 -1
  9. package/bundles/main-class-componentes-input.umd.js +2 -2
  10. package/bundles/main-class-componentes-input.umd.js.map +1 -1
  11. package/bundles/main-class-componentes-input.umd.min.js +1 -1
  12. package/bundles/main-class-componentes-loader.umd.js +1 -1
  13. package/bundles/main-class-componentes-loader.umd.min.js +1 -1
  14. package/bundles/main-class-componentes-loader.umd.min.js.map +1 -1
  15. package/bundles/main-class-componentes-model.umd.js +2 -1
  16. package/bundles/main-class-componentes-model.umd.js.map +1 -1
  17. package/bundles/main-class-componentes-model.umd.min.js +1 -1
  18. package/bundles/main-class-componentes-model.umd.min.js.map +1 -1
  19. package/dialog/main-class-componentes-dialog.metadata.json +1 -1
  20. package/esm2015/core/src/validator/valida-modulo11.service.js +4 -10
  21. package/esm2015/dialog/src/dialog-confirmacao/dialog-confirmacao.component.js +3 -3
  22. package/esm2015/input/index.js +2 -1
  23. package/esm2015/input/main-class-componentes-input.js +2 -3
  24. package/esm2015/loader/src/loader.component.js +1 -1
  25. package/esm2015/model/src/masked-model.directive.js +3 -2
  26. package/fesm2015/main-class-componentes-core.js +3 -9
  27. package/fesm2015/main-class-componentes-core.js.map +1 -1
  28. package/fesm2015/main-class-componentes-dialog.js +2 -2
  29. package/fesm2015/main-class-componentes-dialog.js.map +1 -1
  30. package/fesm2015/main-class-componentes-input.js +1 -1
  31. package/fesm2015/main-class-componentes-input.js.map +1 -1
  32. package/fesm2015/main-class-componentes-loader.js +1 -1
  33. package/fesm2015/main-class-componentes-model.js +2 -1
  34. package/fesm2015/main-class-componentes-model.js.map +1 -1
  35. package/input/index.d.ts +1 -0
  36. package/input/main-class-componentes-input.d.ts +1 -2
  37. package/input/main-class-componentes-input.metadata.json +1 -1
  38. package/loader/main-class-componentes-loader.metadata.json +1 -1
  39. package/model/main-class-componentes-model.metadata.json +1 -1
  40. package/package.json +1 -1
@@ -62,15 +62,9 @@
62
62
  ValidaModulo11Service.prototype.calculateCnpjDv = function (base, weights) {
63
63
  var sum = 0;
64
64
  for (var i = 0; i < base.length; i++) {
65
- var char = base[i];
66
- var value = void 0;
67
- if (/[0-9]/.test(char)) {
68
- value = Number(char);
69
- }
70
- else {
71
- // A=10, B=11, ..., Z=35 (conforme norma da Receita Federal)
72
- value = char.charCodeAt(0) - 55;
73
- }
65
+ // Norma da Receita Federal (CNPJ alfanumérico): valor do caractere = código ASCII - 48
66
+ // ('0'-'9' => 0..9; 'A'-'Z' => 17..42)
67
+ var value = base.charCodeAt(i) - 48;
74
68
  sum += value * weights[i];
75
69
  }
76
70
  var remainder = sum % 11;
@@ -1 +1 @@
1
- {"version":3,"file":"main-class-componentes-core.umd.js","sources":["../../../../projects/main-class/componentes/core/src/validator/valida-modulo11.service.ts","../../../../projects/main-class/componentes/core/src/criptografia/criptografia.service.ts","../../../../projects/main-class/componentes/core/src/mensageria/mensageria.service.ts","../../../../projects/main-class/componentes/core/src/mobile/mobile.service.ts","../../../../projects/main-class/componentes/core/src/core.module.ts","../../../../projects/main-class/componentes/core/main-class-componentes-core.ts"],"sourcesContent":["import {Injectable} from '@angular/core';\n\n@Injectable()\nexport class ValidaModulo11Service {\n\n /**\n * Método que verifica a validade de um CPF.\n *\n * @param cpf - String com CPF a ser validado.\n * @return True se CPF é válido e false caso contrário.\n */\n isValidCpf(cpf: string): boolean {\n if ((cpf.length === 11) && !this.isRepeatedNumber(cpf) &&\n (Number(cpf.charAt(9)) === this.calculateDvMod11(cpf, 9, 2, 11)) &&\n (Number(cpf.charAt(10)) === this.calculateDvMod11(cpf, 10, 2, 11))) {\n return true;\n }\n\n return false;\n }\n\n /**\n * <P>\n * Método que verifica a validade de um CGC (CNPJ).\n * Suporta o novo formato alfanumérico.\n * </p>\n * <P>\n * Um CGC é válido se tiver o seguinte formato: RRRRRRRRFFFFDD (tamanho 14), onde:\n * </p>\n * <UL>\n * <li>RRRRRRRR - Raiz do CGC;</li>\n * <li>FFFF - Filial;</li>\n * <li>DD - Dígito verificador.</li>\n * </ul>\n *\n * @param cgc - String com CGC a ser validado.\n * @return True se CGC é válido e false caso contrário.\n */\n isValidCgc(cgc: string): boolean {\n if (cgc.length !== 14 || this.isRepeatedNumber(cgc)) {\n return false;\n }\n\n const cgcUpper = cgc.toUpperCase();\n const weights1 = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];\n const weights2 = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];\n\n const dv1 = this.calculateCnpjDv(cgcUpper.substring(0, 12), weights1);\n const dv2 = this.calculateCnpjDv(cgcUpper.substring(0, 12) + dv1, weights2);\n\n return cgcUpper.endsWith(`${dv1}${dv2}`);\n }\n\n /**\n * Calcula o dígito verificador do CNPJ (numérico ou alfanumérico).\n * @param base A parte do CNPJ sobre a qual o DV será calculado.\n * @param weights Os pesos para o cálculo.\n * @private\n */\n private calculateCnpjDv(base: string, weights: number[]): number {\n let sum = 0;\n for (let i = 0; i < base.length; i++) {\n const char = base[i];\n let value: number;\n\n if (/[0-9]/.test(char)) {\n value = Number(char);\n } else {\n // A=10, B=11, ..., Z=35 (conforme norma da Receita Federal)\n value = char.charCodeAt(0) - 55;\n }\n\n sum += value * weights[i];\n }\n\n const remainder = sum % 11;\n return remainder < 2 ? 0 : 11 - remainder;\n }\n\n /**\n * Método que verifica se cadeia é composta apenas por caracteres numéricos repetidos (tudo 0 ou tudo 1, ...). Utilizado nas rotinas que\n * testam cpf e cgc.\n *\n * @param cadeia - Cadeia a ser checada.\n * @return True caso cadeia seja formado somente com dígitos e false caso contrário.\n */\n isRepeatedNumber(cadeia: string): boolean {\n let ind = 1;\n let ch = cadeia.charAt(0);\n\n while (ind < cadeia.length) {\n if (ch === cadeia.charAt(ind)) {\n ind++;\n } else {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Método que calcula o dígito verificador módulo 11 de uma cadeia.\n *\n * @param cadeia - Cadeia ser calculado o dígito verificador.\n * @param tam - Número de dígitos a serem utilizados no cálculo.\n * @param fatorInicial - Valor base no fator de multiplicação.\n * @param fatorFinal - Valor limite do fator de multiplicação.\n * @return Valor (decimal) do d�gito verificador.\n */\n calculateDvMod11(cadeia: string, tam: number, fatorInicial: number, fatorFinal: number): number {\n let fator = fatorInicial;\n let total = 0;\n\n for (let ind = 0; ind < tam; ind++) {\n total += Number(cadeia.charAt(tam - ind - 1)) * fator;\n fator++;\n\n if (fator > fatorFinal) {\n fator = fatorInicial;\n }\n }\n\n total %= 11;\n\n if (total < 2) {\n return 0;\n }\n\n return (11 - total);\n }\n\n\n}\n","import {Injectable} from '@angular/core';\nimport JSEncrypt from 'jsencrypt';\n\n@Injectable()\nexport class CriptografiaService {\n\n public criptografa(chavePublica: string, senha: string): string {\n const rsa = new JSEncrypt(undefined);\n rsa.setPublicKey(chavePublica);\n return rsa.encrypt(senha) as string;\n }\n\n}\n","import {Injectable} from '@angular/core';\nimport {MatSnackBar, MatSnackBarConfig, MatSnackBarHorizontalPosition, MatSnackBarVerticalPosition} from '@angular/material/snack-bar';\nimport {TranslateService} from '@ngx-translate/core';\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MensageriaService {\n\n defaultHorizontalPosition: MatSnackBarHorizontalPosition = 'right';\n defaultVerticalPosition: MatSnackBarVerticalPosition = 'top';\n defaultDuration = 2000;\n\n private $defaultComponent: any;\n\n constructor(\n private snackBar: MatSnackBar,\n private translateService: TranslateService,\n ) {\n }\n\n setDefaultComponent(defaultComponent: any) {\n this.$defaultComponent = defaultComponent;\n }\n\n addMensagemFromComponent(component: any, config?: MatSnackBarConfig) {\n this.snackBar.openFromComponent(component, {\n horizontalPosition: this.defaultHorizontalPosition,\n verticalPosition: this.defaultVerticalPosition,\n duration: this.defaultDuration,\n ...config,\n });\n }\n\n addMensagem(mensagem: string, args = {}, action = 'OK', config?: MatSnackBarConfig) {\n const parsedConfig = {\n horizontalPosition: this.defaultHorizontalPosition,\n verticalPosition: this.defaultVerticalPosition,\n duration: this.defaultDuration,\n ...config,\n };\n\n let ref;\n if (!!this.$defaultComponent) {\n ref = this.snackBar.openFromComponent(this.$defaultComponent,\n {\n ...parsedConfig,\n data: {\n message: this.translateService.instant(mensagem, args),\n data: parsedConfig.data,\n },\n });\n } else {\n ref = this.snackBar.open(this.translateService.instant(mensagem, args), 'OK', parsedConfig);\n }\n\n ref.onAction().subscribe(() => {\n ref.dismiss();\n });\n }\n}\n","import {Injectable} from '@angular/core';\nimport {MediaMatcher} from '@angular/cdk/layout';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MobileService {\n mobileQuery: MediaQueryList;\n tabletQuery: MediaQueryList;\n\n private mobileQueryListener: () => void;\n\n private listeners = [];\n\n constructor(\n media: MediaMatcher\n ) {\n this.mobileQuery = media.matchMedia('(max-width: 600px)');\n this.tabletQuery = media.matchMedia('(max-width: 950px)');\n\n this.mobileQueryListener = () => {\n this.listeners.forEach(listener => {\n try {\n listener(this.mobile, this.tablet);\n } catch (e) {\n console.error(e);\n }\n });\n };\n\n this.mobileQuery.addEventListener('change', this.mobileQueryListener);\n this.tabletQuery.addEventListener('change', this.mobileQueryListener);\n }\n\n addListener(listener: (mobile: boolean, tablet?: boolean) => void) {\n this.listeners.push(listener);\n }\n\n removeListener(listener: (mobile: boolean, tablet?: boolean) => void) {\n this.listeners.splice(this.listeners.indexOf(listener), 1);\n }\n\n get mobile() {\n return this.mobileQuery.matches;\n }\n\n get tablet() {\n return this.tabletQuery.matches;\n }\n\n}\n","import {ModuleWithProviders, NgModule} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {ValidaModulo11Service} from './validator/valida-modulo11.service';\nimport {CriptografiaService} from './criptografia/criptografia.service';\nimport {MensageriaService} from './mensageria/mensageria.service';\nimport {MobileService} from './mobile/mobile.service';\n\n\n@NgModule({\n imports: [\n CommonModule,\n ]\n})\nexport class CoreModule {\n\n static forRoot(): ModuleWithProviders<CoreModule> {\n return {\n ngModule: CoreModule,\n providers: [\n ValidaModulo11Service,\n CriptografiaService,\n MensageriaService,\n MobileService,\n ]\n };\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["Injectable","JSEncrypt","MatSnackBar","TranslateService","MediaMatcher","NgModule","CommonModule"],"mappings":";;;;;;;;;;;QAGA;;;;;;;;QAQE,0CAAU,GAAV,UAAW,GAAW;YACpB,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC;iBACnD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;iBAC/D,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE;gBACpE,OAAO,IAAI,CAAC;aACb;YAED,OAAO,KAAK,CAAC;SACd;;;;;;;;;;;;;;;;;;QAmBD,0CAAU,GAAV,UAAW,GAAW;YACpB,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE;gBACnD,OAAO,KAAK,CAAC;aACd;YAED,IAAM,QAAQ,GAAG,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SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACjC;QAED,sCAAc,GAAd,UAAe,QAAqD;YAChE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;SAC9D;QAED,sBAAI,iCAAM;iBAAV;gBACI,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;aACnC;;;WAAA;QAED,sBAAI,iCAAM;iBAAV;gBACI,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;aACnC;;;WAAA;;;;;gBA7CJH,aAAU,SAAC;oBACR,UAAU,EAAE,MAAM;iBACrB;;;gBAJOI,iBAAY;;;;QCYpB;;QAES,kBAAO,GAAd;YACE,OAAO;gBACL,QAAQ,EAAE,UAAU;gBACpB,SAAS,EAAE;oBACT,qBAAqB;oBACrB,mBAAmB;oBACnB,iBAAiB;oBACjB,aAAa;iBACd;aACF,CAAC;SACH;;;;gBAjBFC,WAAQ,SAAC;oBACR,OAAO,EAAE;wBACPC,mBAAY;qBACb;iBACF;;;ICZD;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"main-class-componentes-core.umd.js","sources":["../../../../projects/main-class/componentes/core/src/validator/valida-modulo11.service.ts","../../../../projects/main-class/componentes/core/src/criptografia/criptografia.service.ts","../../../../projects/main-class/componentes/core/src/mensageria/mensageria.service.ts","../../../../projects/main-class/componentes/core/src/mobile/mobile.service.ts","../../../../projects/main-class/componentes/core/src/core.module.ts","../../../../projects/main-class/componentes/core/main-class-componentes-core.ts"],"sourcesContent":["import {Injectable} from '@angular/core';\n\n@Injectable()\nexport class ValidaModulo11Service {\n\n /**\n * Método que verifica a validade de um CPF.\n *\n * @param cpf - String com CPF a ser validado.\n * @return True se CPF é válido e false caso contrário.\n */\n isValidCpf(cpf: string): boolean {\n if ((cpf.length === 11) && !this.isRepeatedNumber(cpf) &&\n (Number(cpf.charAt(9)) === this.calculateDvMod11(cpf, 9, 2, 11)) &&\n (Number(cpf.charAt(10)) === this.calculateDvMod11(cpf, 10, 2, 11))) {\n return true;\n }\n\n return false;\n }\n\n /**\n * <P>\n * Método que verifica a validade de um CGC (CNPJ).\n * Suporta o novo formato alfanumérico.\n * </p>\n * <P>\n * Um CGC é válido se tiver o seguinte formato: RRRRRRRRFFFFDD (tamanho 14), onde:\n * </p>\n * <UL>\n * <li>RRRRRRRR - Raiz do CGC;</li>\n * <li>FFFF - Filial;</li>\n * <li>DD - Dígito verificador.</li>\n * </ul>\n *\n * @param cgc - String com CGC a ser validado.\n * @return True se CGC é válido e false caso contrário.\n */\n isValidCgc(cgc: string): boolean {\n if (cgc.length !== 14 || this.isRepeatedNumber(cgc)) {\n return false;\n }\n\n const cgcUpper = cgc.toUpperCase();\n const weights1 = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];\n const weights2 = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];\n\n const dv1 = this.calculateCnpjDv(cgcUpper.substring(0, 12), weights1);\n const dv2 = this.calculateCnpjDv(cgcUpper.substring(0, 12) + dv1, weights2);\n\n return cgcUpper.endsWith(`${dv1}${dv2}`);\n }\n\n /**\n * Calcula o dígito verificador do CNPJ (numérico ou alfanumérico).\n * @param base A parte do CNPJ sobre a qual o DV será calculado.\n * @param weights Os pesos para o cálculo.\n * @private\n */\n private calculateCnpjDv(base: string, weights: number[]): number {\n let sum = 0;\n for (let i = 0; i < base.length; i++) {\n // Norma da Receita Federal (CNPJ alfanumérico): valor do caractere = código ASCII - 48\n // ('0'-'9' => 0..9; 'A'-'Z' => 17..42)\n const value = base.charCodeAt(i) - 48;\n\n sum += value * weights[i];\n }\n\n const remainder = sum % 11;\n return remainder < 2 ? 0 : 11 - remainder;\n }\n\n /**\n * Método que verifica se cadeia é composta apenas por caracteres numéricos repetidos (tudo 0 ou tudo 1, ...). Utilizado nas rotinas que\n * testam cpf e cgc.\n *\n * @param cadeia - Cadeia a ser checada.\n * @return True caso cadeia seja formado somente com dígitos e false caso contrário.\n */\n isRepeatedNumber(cadeia: string): boolean {\n let ind = 1;\n let ch = cadeia.charAt(0);\n\n while (ind < cadeia.length) {\n if (ch === cadeia.charAt(ind)) {\n ind++;\n } else {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Método que calcula o dígito verificador módulo 11 de uma cadeia.\n *\n * @param cadeia - Cadeia ser calculado o dígito verificador.\n * @param tam - Número de dígitos a serem utilizados no cálculo.\n * @param fatorInicial - Valor base no fator de multiplicação.\n * @param fatorFinal - Valor limite do fator de multiplicação.\n * @return Valor (decimal) do d�gito verificador.\n */\n calculateDvMod11(cadeia: string, tam: number, fatorInicial: number, fatorFinal: number): number {\n let fator = fatorInicial;\n let total = 0;\n\n for (let ind = 0; ind < tam; ind++) {\n total += Number(cadeia.charAt(tam - ind - 1)) * fator;\n fator++;\n\n if (fator > fatorFinal) {\n fator = fatorInicial;\n }\n }\n\n total %= 11;\n\n if (total < 2) {\n return 0;\n }\n\n return (11 - total);\n }\n\n\n}\n","import {Injectable} from '@angular/core';\nimport JSEncrypt from 'jsencrypt';\n\n@Injectable()\nexport class CriptografiaService {\n\n public criptografa(chavePublica: string, senha: string): string {\n const rsa = new JSEncrypt(undefined);\n rsa.setPublicKey(chavePublica);\n return rsa.encrypt(senha) as string;\n }\n\n}\n","import {Injectable} from '@angular/core';\nimport {MatSnackBar, MatSnackBarConfig, MatSnackBarHorizontalPosition, MatSnackBarVerticalPosition} from '@angular/material/snack-bar';\nimport {TranslateService} from '@ngx-translate/core';\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MensageriaService {\n\n defaultHorizontalPosition: MatSnackBarHorizontalPosition = 'right';\n defaultVerticalPosition: MatSnackBarVerticalPosition = 'top';\n defaultDuration = 2000;\n\n private $defaultComponent: any;\n\n constructor(\n private snackBar: MatSnackBar,\n private translateService: TranslateService,\n ) {\n }\n\n setDefaultComponent(defaultComponent: any) {\n this.$defaultComponent = defaultComponent;\n }\n\n addMensagemFromComponent(component: any, config?: MatSnackBarConfig) {\n this.snackBar.openFromComponent(component, {\n horizontalPosition: this.defaultHorizontalPosition,\n verticalPosition: this.defaultVerticalPosition,\n duration: this.defaultDuration,\n ...config,\n });\n }\n\n addMensagem(mensagem: string, args = {}, action = 'OK', config?: MatSnackBarConfig) {\n const parsedConfig = {\n horizontalPosition: this.defaultHorizontalPosition,\n verticalPosition: this.defaultVerticalPosition,\n duration: this.defaultDuration,\n ...config,\n };\n\n let ref;\n if (!!this.$defaultComponent) {\n ref = this.snackBar.openFromComponent(this.$defaultComponent,\n {\n ...parsedConfig,\n data: {\n message: this.translateService.instant(mensagem, args),\n data: parsedConfig.data,\n },\n });\n } else {\n ref = this.snackBar.open(this.translateService.instant(mensagem, args), 'OK', parsedConfig);\n }\n\n ref.onAction().subscribe(() => {\n ref.dismiss();\n });\n }\n}\n","import {Injectable} from '@angular/core';\nimport {MediaMatcher} from '@angular/cdk/layout';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MobileService {\n mobileQuery: MediaQueryList;\n tabletQuery: MediaQueryList;\n\n private mobileQueryListener: () => void;\n\n private listeners = [];\n\n constructor(\n media: MediaMatcher\n ) {\n this.mobileQuery = media.matchMedia('(max-width: 600px)');\n this.tabletQuery = media.matchMedia('(max-width: 950px)');\n\n this.mobileQueryListener = () => {\n this.listeners.forEach(listener => {\n try {\n listener(this.mobile, this.tablet);\n } catch (e) {\n console.error(e);\n }\n });\n };\n\n this.mobileQuery.addEventListener('change', this.mobileQueryListener);\n this.tabletQuery.addEventListener('change', this.mobileQueryListener);\n }\n\n addListener(listener: (mobile: boolean, tablet?: boolean) => void) {\n this.listeners.push(listener);\n }\n\n removeListener(listener: (mobile: boolean, tablet?: boolean) => void) {\n this.listeners.splice(this.listeners.indexOf(listener), 1);\n }\n\n get mobile() {\n return this.mobileQuery.matches;\n }\n\n get tablet() {\n return this.tabletQuery.matches;\n }\n\n}\n","import {ModuleWithProviders, NgModule} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {ValidaModulo11Service} from './validator/valida-modulo11.service';\nimport {CriptografiaService} from './criptografia/criptografia.service';\nimport {MensageriaService} from './mensageria/mensageria.service';\nimport {MobileService} from './mobile/mobile.service';\n\n\n@NgModule({\n imports: [\n CommonModule,\n ]\n})\nexport class CoreModule {\n\n static forRoot(): ModuleWithProviders<CoreModule> {\n return {\n ngModule: CoreModule,\n providers: [\n ValidaModulo11Service,\n CriptografiaService,\n MensageriaService,\n MobileService,\n ]\n };\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["Injectable","JSEncrypt","MatSnackBar","TranslateService","MediaMatcher","NgModule","CommonModule"],"mappings":";;;;;;;;;;;QAGA;;;;;;;;QAQE,0CAAU,GAAV,UAAW,GAAW;YACpB,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC;iBACnD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;iBAC/D,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE;gBACpE,OAAO,IAAI,CAAC;aACb;YAED,OAAO,KAAK,CAAC;SACd;;;;;;;;;;;;;;;;;;QAmBD,0CAAU,GAAV,UAAW,GAAW;YACpB,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE;gBACnD,OAAO,KAAK,CAAC;aACd;YAED,IAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;YACnC,IAAM,QAAQ,GAAG,CAAC,CAA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AAO,CAAC;aACnC;;;WAAA;QAED,sBAAI,iCAAM;iBAAV;gBACI,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;aACnC;;;WAAA;;;;;gBA7CJH,aAAU,SAAC;oBACR,UAAU,EAAE,MAAM;iBACrB;;;gBAJOI,iBAAY;;;;QCYpB;;QAES,kBAAO,GAAd;YACE,OAAO;gBACL,QAAQ,EAAE,UAAU;gBACpB,SAAS,EAAE;oBACT,qBAAqB;oBACrB,mBAAmB;oBACnB,iBAAiB;oBACjB,aAAa;iBACd;aACF,CAAC;SACH;;;;gBAjBFC,WAAQ,SAAC;oBACR,OAAO,EAAE;wBACPC,mBAAY;qBACb;iBACF;;;ICZD;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("jsencrypt"),require("@angular/material/snack-bar"),require("@ngx-translate/core"),require("@angular/cdk/layout")):"function"==typeof define&&define.amd?define("@main-class/componentes/core",["exports","@angular/core","@angular/common","jsencrypt","@angular/material/snack-bar","@ngx-translate/core","@angular/cdk/layout"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["main-class"]=e["main-class"]||{},e["main-class"].componentes=e["main-class"].componentes||{},e["main-class"].componentes.core={}),e.ng.core,e.ng.common,e.JSEncrypt,e.ng.material.snackBar,e.i2,e.ng.cdk.layout)}(this,(function(e,t,n,r,o,i,a){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(r),u=function(){function e(){}return e.prototype.isValidCpf=function(e){return 11===e.length&&!this.isRepeatedNumber(e)&&Number(e.charAt(9))===this.calculateDvMod11(e,9,2,11)&&Number(e.charAt(10))===this.calculateDvMod11(e,10,2,11)},e.prototype.isValidCgc=function(e){if(14!==e.length||this.isRepeatedNumber(e))return!1;var t=e.toUpperCase(),n=this.calculateCnpjDv(t.substring(0,12),[5,4,3,2,9,8,7,6,5,4,3,2]),r=this.calculateCnpjDv(t.substring(0,12)+n,[6,5,4,3,2,9,8,7,6,5,4,3,2]);return t.endsWith(""+n+r)},e.prototype.calculateCnpjDv=function(e,t){for(var n=0,r=0;r<e.length;r++){var o=e[r];n+=(/[0-9]/.test(o)?Number(o):o.charCodeAt(0)-55)*t[r]}var i=n%11;return i<2?0:11-i},e.prototype.isRepeatedNumber=function(e){for(var t=1,n=e.charAt(0);t<e.length;){if(n!==e.charAt(t))return!1;t++}return!0},e.prototype.calculateDvMod11=function(e,t,n,r){for(var o=n,i=0,a=0;a<t;a++)i+=Number(e.charAt(t-a-1))*o,++o>r&&(o=n);return(i%=11)<2?0:11-i},e}();u.decorators=[{type:t.Injectable}];var l=function(){function e(){}return e.prototype.criptografa=function(e,t){var n=new c.default(void 0);return n.setPublicKey(e),n.encrypt(t)},e}();l.decorators=[{type:t.Injectable}];var d=function(){function e(e,t){this.snackBar=e,this.translateService=t,this.defaultHorizontalPosition="right",this.defaultVerticalPosition="top",this.defaultDuration=2e3}return e.prototype.setDefaultComponent=function(e){this.$defaultComponent=e},e.prototype.addMensagemFromComponent=function(e,t){this.snackBar.openFromComponent(e,Object.assign({horizontalPosition:this.defaultHorizontalPosition,verticalPosition:this.defaultVerticalPosition,duration:this.defaultDuration},t))},e.prototype.addMensagem=function(e,t,n,r){void 0===t&&(t={}),void 0===n&&(n="OK");var o,i=Object.assign({horizontalPosition:this.defaultHorizontalPosition,verticalPosition:this.defaultVerticalPosition,duration:this.defaultDuration},r);(o=this.$defaultComponent?this.snackBar.openFromComponent(this.$defaultComponent,Object.assign(Object.assign({},i),{data:{message:this.translateService.instant(e,t),data:i.data}})):this.snackBar.open(this.translateService.instant(e,t),"OK",i)).onAction().subscribe((function(){o.dismiss()}))},e}();d.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new d(t.ɵɵinject(o.MatSnackBar),t.ɵɵinject(i.TranslateService))},token:d,providedIn:"root"}),d.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],d.ctorParameters=function(){return[{type:o.MatSnackBar},{type:i.TranslateService}]};var p=function(){function e(e){var t=this;this.listeners=[],this.mobileQuery=e.matchMedia("(max-width: 600px)"),this.tabletQuery=e.matchMedia("(max-width: 950px)"),this.mobileQueryListener=function(){t.listeners.forEach((function(e){try{e(t.mobile,t.tablet)}catch(e){console.error(e)}}))},this.mobileQuery.addEventListener("change",this.mobileQueryListener),this.tabletQuery.addEventListener("change",this.mobileQueryListener)}return e.prototype.addListener=function(e){this.listeners.push(e)},e.prototype.removeListener=function(e){this.listeners.splice(this.listeners.indexOf(e),1)},Object.defineProperty(e.prototype,"mobile",{get:function(){return this.mobileQuery.matches},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tablet",{get:function(){return this.tabletQuery.matches},enumerable:!1,configurable:!0}),e}();p.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new p(t.ɵɵinject(a.MediaMatcher))},token:p,providedIn:"root"}),p.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],p.ctorParameters=function(){return[{type:a.MediaMatcher}]};var f=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[u,l,d,p]}},e}();f.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule]}]}],e.CoreModule=f,e.CriptografiaService=l,e.MensageriaService=d,e.MobileService=p,e.ValidaModulo11Service=u,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("jsencrypt"),require("@angular/material/snack-bar"),require("@ngx-translate/core"),require("@angular/cdk/layout")):"function"==typeof define&&define.amd?define("@main-class/componentes/core",["exports","@angular/core","@angular/common","jsencrypt","@angular/material/snack-bar","@ngx-translate/core","@angular/cdk/layout"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["main-class"]=e["main-class"]||{},e["main-class"].componentes=e["main-class"].componentes||{},e["main-class"].componentes.core={}),e.ng.core,e.ng.common,e.JSEncrypt,e.ng.material.snackBar,e.i2,e.ng.cdk.layout)}(this,(function(e,t,n,r,o,i,a){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(r),u=function(){function e(){}return e.prototype.isValidCpf=function(e){return 11===e.length&&!this.isRepeatedNumber(e)&&Number(e.charAt(9))===this.calculateDvMod11(e,9,2,11)&&Number(e.charAt(10))===this.calculateDvMod11(e,10,2,11)},e.prototype.isValidCgc=function(e){if(14!==e.length||this.isRepeatedNumber(e))return!1;var t=e.toUpperCase(),n=this.calculateCnpjDv(t.substring(0,12),[5,4,3,2,9,8,7,6,5,4,3,2]),r=this.calculateCnpjDv(t.substring(0,12)+n,[6,5,4,3,2,9,8,7,6,5,4,3,2]);return t.endsWith(""+n+r)},e.prototype.calculateCnpjDv=function(e,t){for(var n=0,r=0;r<e.length;r++){n+=(e.charCodeAt(r)-48)*t[r]}var o=n%11;return o<2?0:11-o},e.prototype.isRepeatedNumber=function(e){for(var t=1,n=e.charAt(0);t<e.length;){if(n!==e.charAt(t))return!1;t++}return!0},e.prototype.calculateDvMod11=function(e,t,n,r){for(var o=n,i=0,a=0;a<t;a++)i+=Number(e.charAt(t-a-1))*o,++o>r&&(o=n);return(i%=11)<2?0:11-i},e}();u.decorators=[{type:t.Injectable}];var l=function(){function e(){}return e.prototype.criptografa=function(e,t){var n=new c.default(void 0);return n.setPublicKey(e),n.encrypt(t)},e}();l.decorators=[{type:t.Injectable}];var d=function(){function e(e,t){this.snackBar=e,this.translateService=t,this.defaultHorizontalPosition="right",this.defaultVerticalPosition="top",this.defaultDuration=2e3}return e.prototype.setDefaultComponent=function(e){this.$defaultComponent=e},e.prototype.addMensagemFromComponent=function(e,t){this.snackBar.openFromComponent(e,Object.assign({horizontalPosition:this.defaultHorizontalPosition,verticalPosition:this.defaultVerticalPosition,duration:this.defaultDuration},t))},e.prototype.addMensagem=function(e,t,n,r){void 0===t&&(t={}),void 0===n&&(n="OK");var o,i=Object.assign({horizontalPosition:this.defaultHorizontalPosition,verticalPosition:this.defaultVerticalPosition,duration:this.defaultDuration},r);(o=this.$defaultComponent?this.snackBar.openFromComponent(this.$defaultComponent,Object.assign(Object.assign({},i),{data:{message:this.translateService.instant(e,t),data:i.data}})):this.snackBar.open(this.translateService.instant(e,t),"OK",i)).onAction().subscribe((function(){o.dismiss()}))},e}();d.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new d(t.ɵɵinject(o.MatSnackBar),t.ɵɵinject(i.TranslateService))},token:d,providedIn:"root"}),d.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],d.ctorParameters=function(){return[{type:o.MatSnackBar},{type:i.TranslateService}]};var p=function(){function e(e){var t=this;this.listeners=[],this.mobileQuery=e.matchMedia("(max-width: 600px)"),this.tabletQuery=e.matchMedia("(max-width: 950px)"),this.mobileQueryListener=function(){t.listeners.forEach((function(e){try{e(t.mobile,t.tablet)}catch(e){console.error(e)}}))},this.mobileQuery.addEventListener("change",this.mobileQueryListener),this.tabletQuery.addEventListener("change",this.mobileQueryListener)}return e.prototype.addListener=function(e){this.listeners.push(e)},e.prototype.removeListener=function(e){this.listeners.splice(this.listeners.indexOf(e),1)},Object.defineProperty(e.prototype,"mobile",{get:function(){return this.mobileQuery.matches},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tablet",{get:function(){return this.tabletQuery.matches},enumerable:!1,configurable:!0}),e}();p.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new p(t.ɵɵinject(a.MediaMatcher))},token:p,providedIn:"root"}),p.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],p.ctorParameters=function(){return[{type:a.MediaMatcher}]};var f=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[u,l,d,p]}},e}();f.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule]}]}],e.CoreModule=f,e.CriptografiaService=l,e.MensageriaService=d,e.MobileService=p,e.ValidaModulo11Service=u,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=main-class-componentes-core.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../projects/main-class/componentes/core/src/validator/valida-modulo11.service.ts","../../../../projects/main-class/componentes/core/src/criptografia/criptografia.service.ts","../../../../projects/main-class/componentes/core/src/mensageria/mensageria.service.ts","../../../../projects/main-class/componentes/core/src/mobile/mobile.service.ts","../../../../projects/main-class/componentes/core/src/core.module.ts"],"names":["ValidaModulo11Service","prototype","isValidCpf","cpf","length","this","isRepeatedNumber","Number","charAt","calculateDvMod11","isValidCgc","cgc","cgcUpper","toUpperCase","dv1","calculateCnpjDv","substring","dv2","endsWith","base","weights","sum","i","char","test","charCodeAt","remainder","cadeia","ind","ch","tam","fatorInicial","fatorFinal","fator","total","Injectable","CriptografiaService","criptografa","chavePublica","senha","rsa","JSEncrypt","undefined","setPublicKey","encrypt","MensageriaService","snackBar","translateService","defaultHorizontalPosition","defaultVerticalPosition","defaultDuration","setDefaultComponent","defaultComponent","$defaultComponent","addMensagemFromComponent","component","config","openFromComponent","Object","assign","horizontalPosition","verticalPosition","duration","addMensagem","mensagem","args","action","ref","parsedConfig","data","message","instant","open","onAction","subscribe","dismiss","providedIn","MatSnackBar","TranslateService","MobileService","media","_this","listeners","mobileQuery","matchMedia","tabletQuery","mobileQueryListener","forEach","listener","mobile","tablet","e","console","error","addEventListener","addListener","push","removeListener","splice","indexOf","defineProperty","matches","MediaMatcher","CoreModule","forRoot","ngModule","providers","NgModule","imports","CommonModule"],"mappings":"u2BAGA,SAAAA,YAQEA,EAAAC,UAAAC,WAAA,SAAWC,GACT,OAAoB,KAAfA,EAAIC,SAAmBC,KAAKC,iBAAiBH,IAC/CI,OAAOJ,EAAIK,OAAO,MAAQH,KAAKI,iBAAiBN,EAAK,EAAG,EAAG,KAC3DI,OAAOJ,EAAIK,OAAO,OAASH,KAAKI,iBAAiBN,EAAK,GAAI,EAAG,KAwBlEH,EAAAC,UAAAS,WAAA,SAAWC,GACT,GAAmB,KAAfA,EAAIP,QAAiBC,KAAKC,iBAAiBK,GAC7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gF,YAAcL,EAAMI,WAAW,sBAEpC/E,KAAKiF,oBAAsB,WACvBL,EAAKC,UAAUK,SAAQ,SAAAC,GACnB,IACIA,EAASP,EAAKQ,OAAQR,EAAKS,QAC7B,MAAOC,GACLC,QAAQC,MAAMF,QAK1BtF,KAAK8E,YAAYW,iBAAiB,SAAUzF,KAAKiF,qBACjDjF,KAAKgF,YAAYS,iBAAiB,SAAUzF,KAAKiF,4BAGrDP,EAAA9E,UAAA8F,YAAA,SAAYP,GACRnF,KAAK6E,UAAUc,KAAKR,IAGxBT,EAAA9E,UAAAgG,eAAA,SAAeT,GACXnF,KAAK6E,UAAUgB,OAAO7F,KAAK6E,UAAUiB,QAAQX,GAAW,IAG5D9B,OAAA0C,eAAIrB,EAAA9E,UAAA,SAAM,KAAV,WACI,OAAOI,KAAK8E,YAAYkB,yCAG5B3C,OAAA0C,eAAIrB,EAAA9E,UAAA,SAAM,KAAV,WACI,OAAOI,KAAKgF,YAAYgB,yLA5C/BlE,EAAAA,WAAU8B,KAAA,CAAC,CACRW,WAAY,oDAHR0B,EAAAA,iCCYR,SAAAC,YAESA,EAAAC,QAAP,WACE,MAAO,CACLC,SAAUF,EACVG,UAAW,CACT1G,EACAoC,EACAS,EACAkC,8BAdP4B,EAAAA,SAAQ1C,KAAA,CAAC,CACR2C,QAAS,CACPC,EAAAA","sourcesContent":["import {Injectable} from '@angular/core';\n\n@Injectable()\nexport class ValidaModulo11Service {\n\n /**\n * Método que verifica a validade de um CPF.\n *\n * @param cpf - String com CPF a ser validado.\n * @return True se CPF é válido e false caso contrário.\n */\n isValidCpf(cpf: string): boolean {\n if ((cpf.length === 11) && !this.isRepeatedNumber(cpf) &&\n (Number(cpf.charAt(9)) === this.calculateDvMod11(cpf, 9, 2, 11)) &&\n (Number(cpf.charAt(10)) === this.calculateDvMod11(cpf, 10, 2, 11))) {\n return true;\n }\n\n return false;\n }\n\n /**\n * <P>\n * Método que verifica a validade de um CGC (CNPJ).\n * Suporta o novo formato alfanumérico.\n * </p>\n * <P>\n * Um CGC é válido se tiver o seguinte formato: RRRRRRRRFFFFDD (tamanho 14), onde:\n * </p>\n * <UL>\n * <li>RRRRRRRR - Raiz do CGC;</li>\n * <li>FFFF - Filial;</li>\n * <li>DD - Dígito verificador.</li>\n * </ul>\n *\n * @param cgc - String com CGC a ser validado.\n * @return True se CGC é válido e false caso contrário.\n */\n isValidCgc(cgc: string): boolean {\n if (cgc.length !== 14 || this.isRepeatedNumber(cgc)) {\n return false;\n }\n\n const cgcUpper = cgc.toUpperCase();\n const weights1 = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];\n const weights2 = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];\n\n const dv1 = this.calculateCnpjDv(cgcUpper.substring(0, 12), weights1);\n const dv2 = this.calculateCnpjDv(cgcUpper.substring(0, 12) + dv1, weights2);\n\n return cgcUpper.endsWith(`${dv1}${dv2}`);\n }\n\n /**\n * Calcula o dígito verificador do CNPJ (numérico ou alfanumérico).\n * @param base A parte do CNPJ sobre a qual o DV será calculado.\n * @param weights Os pesos para o cálculo.\n * @private\n */\n private calculateCnpjDv(base: string, weights: number[]): number {\n let sum = 0;\n for (let i = 0; i < base.length; i++) {\n const char = base[i];\n let value: number;\n\n if (/[0-9]/.test(char)) {\n value = Number(char);\n } else {\n // A=10, B=11, ..., Z=35 (conforme norma da Receita Federal)\n value = char.charCodeAt(0) - 55;\n }\n\n sum += value * weights[i];\n }\n\n const remainder = sum % 11;\n return remainder < 2 ? 0 : 11 - remainder;\n }\n\n /**\n * Método que verifica se cadeia é composta apenas por caracteres numéricos repetidos (tudo 0 ou tudo 1, ...). Utilizado nas rotinas que\n * testam cpf e cgc.\n *\n * @param cadeia - Cadeia a ser checada.\n * @return True caso cadeia seja formado somente com dígitos e false caso contrário.\n */\n isRepeatedNumber(cadeia: string): boolean {\n let ind = 1;\n let ch = cadeia.charAt(0);\n\n while (ind < cadeia.length) {\n if (ch === cadeia.charAt(ind)) {\n ind++;\n } else {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Método que calcula o dígito verificador módulo 11 de uma cadeia.\n *\n * @param cadeia - Cadeia ser calculado o dígito verificador.\n * @param tam - Número de dígitos a serem utilizados no cálculo.\n * @param fatorInicial - Valor base no fator de multiplicação.\n * @param fatorFinal - Valor limite do fator de multiplicação.\n * @return Valor (decimal) do d�gito verificador.\n */\n calculateDvMod11(cadeia: string, tam: number, fatorInicial: number, fatorFinal: number): number {\n let fator = fatorInicial;\n let total = 0;\n\n for (let ind = 0; ind < tam; ind++) {\n total += Number(cadeia.charAt(tam - ind - 1)) * fator;\n fator++;\n\n if (fator > fatorFinal) {\n fator = fatorInicial;\n }\n }\n\n total %= 11;\n\n if (total < 2) {\n return 0;\n }\n\n return (11 - total);\n }\n\n\n}\n","import {Injectable} from '@angular/core';\nimport JSEncrypt from 'jsencrypt';\n\n@Injectable()\nexport class CriptografiaService {\n\n public criptografa(chavePublica: string, senha: string): string {\n const rsa = new JSEncrypt(undefined);\n rsa.setPublicKey(chavePublica);\n return rsa.encrypt(senha) as string;\n }\n\n}\n","import {Injectable} from '@angular/core';\nimport {MatSnackBar, MatSnackBarConfig, MatSnackBarHorizontalPosition, MatSnackBarVerticalPosition} from '@angular/material/snack-bar';\nimport {TranslateService} from '@ngx-translate/core';\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MensageriaService {\n\n defaultHorizontalPosition: MatSnackBarHorizontalPosition = 'right';\n defaultVerticalPosition: MatSnackBarVerticalPosition = 'top';\n defaultDuration = 2000;\n\n private $defaultComponent: any;\n\n constructor(\n private snackBar: MatSnackBar,\n private translateService: TranslateService,\n ) {\n }\n\n setDefaultComponent(defaultComponent: any) {\n this.$defaultComponent = defaultComponent;\n }\n\n addMensagemFromComponent(component: any, config?: MatSnackBarConfig) {\n this.snackBar.openFromComponent(component, {\n horizontalPosition: this.defaultHorizontalPosition,\n verticalPosition: this.defaultVerticalPosition,\n duration: this.defaultDuration,\n ...config,\n });\n }\n\n addMensagem(mensagem: string, args = {}, action = 'OK', config?: MatSnackBarConfig) {\n const parsedConfig = {\n horizontalPosition: this.defaultHorizontalPosition,\n verticalPosition: this.defaultVerticalPosition,\n duration: this.defaultDuration,\n ...config,\n };\n\n let ref;\n if (!!this.$defaultComponent) {\n ref = this.snackBar.openFromComponent(this.$defaultComponent,\n {\n ...parsedConfig,\n data: {\n message: this.translateService.instant(mensagem, args),\n data: parsedConfig.data,\n },\n });\n } else {\n ref = this.snackBar.open(this.translateService.instant(mensagem, args), 'OK', parsedConfig);\n }\n\n ref.onAction().subscribe(() => {\n ref.dismiss();\n });\n }\n}\n","import {Injectable} from '@angular/core';\nimport {MediaMatcher} from '@angular/cdk/layout';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MobileService {\n mobileQuery: MediaQueryList;\n tabletQuery: MediaQueryList;\n\n private mobileQueryListener: () => void;\n\n private listeners = [];\n\n constructor(\n media: MediaMatcher\n ) {\n this.mobileQuery = media.matchMedia('(max-width: 600px)');\n this.tabletQuery = media.matchMedia('(max-width: 950px)');\n\n this.mobileQueryListener = () => {\n this.listeners.forEach(listener => {\n try {\n listener(this.mobile, this.tablet);\n } catch (e) {\n console.error(e);\n }\n });\n };\n\n this.mobileQuery.addEventListener('change', this.mobileQueryListener);\n this.tabletQuery.addEventListener('change', this.mobileQueryListener);\n }\n\n addListener(listener: (mobile: boolean, tablet?: boolean) => void) {\n this.listeners.push(listener);\n }\n\n removeListener(listener: (mobile: boolean, tablet?: boolean) => void) {\n this.listeners.splice(this.listeners.indexOf(listener), 1);\n }\n\n get mobile() {\n return this.mobileQuery.matches;\n }\n\n get tablet() {\n return this.tabletQuery.matches;\n }\n\n}\n","import {ModuleWithProviders, NgModule} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {ValidaModulo11Service} from './validator/valida-modulo11.service';\nimport {CriptografiaService} from './criptografia/criptografia.service';\nimport {MensageriaService} from './mensageria/mensageria.service';\nimport {MobileService} from './mobile/mobile.service';\n\n\n@NgModule({\n imports: [\n CommonModule,\n ]\n})\nexport class CoreModule {\n\n static forRoot(): ModuleWithProviders<CoreModule> {\n return {\n ngModule: CoreModule,\n providers: [\n ValidaModulo11Service,\n CriptografiaService,\n MensageriaService,\n MobileService,\n ]\n };\n }\n\n}\n"]}
1
+ {"version":3,"sources":["../../../../projects/main-class/componentes/core/src/validator/valida-modulo11.service.ts","../../../../projects/main-class/componentes/core/src/criptografia/criptografia.service.ts","../../../../projects/main-class/componentes/core/src/mensageria/mensageria.service.ts","../../../../projects/main-class/componentes/core/src/mobile/mobile.service.ts","../../../../projects/main-class/componentes/core/src/core.module.ts"],"names":["ValidaModulo11Service","prototype","isValidCpf","cpf","length","this","isRepeatedNumber","Number","charAt","calculateDvMod11","isValidCgc","cgc","cgcUpper","toUpperCase","dv1","calculateCnpjDv","substring","dv2","endsWith","base","weights","sum","i","charCodeAt","remainder","cadeia","ind","ch","tam","fatorInicial","fatorFinal","fator","total","Injectable","CriptografiaService","criptografa","chavePublica","senha","rsa","JSEncrypt","undefined","setPublicKey","encrypt","MensageriaService","snackBar","translateService","defaultHorizontalPosition","defaultVerticalPosition","defaultDuration","setDefaultComponent","defaultComponent","$defaultComponent","addMensagemFromComponent","component","config","openFromComponent","Object","assign","horizontalPosition","verticalPosition","duration","addMensagem","mensagem","args","action","ref","parsedConfig","data","message","instant","open","onAction","subscribe","dismiss","providedIn","MatSnackBar","TranslateService","MobileService","media","_this","listeners","mobileQuery","matchMedia","tabletQuery","mobileQueryListener","forEach","listener","mobile","tablet","e","console","error","addEventListener","addListener","push","removeListener","splice","indexOf","defineProperty","matches","MediaMatcher","CoreModule","forRoot","ngModule","providers","NgModule","imports","CommonModule"],"mappings":"u2BAGA,SAAAA,YAQEA,EAAAC,UAAAC,WAAA,SAAWC,GACT,OAAoB,KAAfA,EAAIC,SAAmBC,KAAKC,iBAAiBH,IAC/CI,OAAOJ,EAAIK,OAAO,MAAQH,KAAKI,iBAAiBN,EAAK,EAAG,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AC,EACIC,GADJ,IAAAC,EAAA1E,KAFQA,KAAA2E,UAAY,GAKhB3E,KAAK4E,YAAcH,EAAMI,WAAW,sBACpC7E,KAAK8E,YAAcL,EAAMI,WAAW,sBAEpC7E,KAAK+E,oBAAsB,WACvBL,EAAKC,UAAUK,SAAQ,SAAAC,GACnB,IACIA,EAASP,EAAKQ,OAAQR,EAAKS,QAC7B,MAAOC,GACLC,QAAQC,MAAMF,QAK1BpF,KAAK4E,YAAYW,iBAAiB,SAAUvF,KAAK+E,qBACjD/E,KAAK8E,YAAYS,iBAAiB,SAAUvF,KAAK+E,4BAGrDP,EAAA5E,UAAA4F,YAAA,SAAYP,GACRjF,KAAK2E,UAAUc,KAAKR,IAGxBT,EAAA5E,UAAA8F,eAAA,SAAeT,GACXjF,KAAK2E,UAAUgB,OAAO3F,KAAK2E,UAAUiB,QAAQX,GAAW,IAG5D9B,OAAA0C,eAAIrB,EAAA5E,UAAA,SAAM,KAAV,WACI,OAAOI,KAAK4E,YAAYkB,yCAG5B3C,OAAA0C,eAAIrB,EAAA5E,UAAA,SAAM,KAAV,WACI,OAAOI,KAAK8E,YAAYgB,yLA5C/BlE,EAAAA,WAAU8B,KAAA,CAAC,CACRW,WAAY,oDAHR0B,EAAAA,iCCYR,SAAAC,YAESA,EAAAC,QAAP,WACE,MAAO,CACLC,SAAUF,EACVG,UAAW,CACTxG,EACAkC,EACAS,EACAkC,8BAdP4B,EAAAA,SAAQ1C,KAAA,CAAC,CACR2C,QAAS,CACPC,EAAAA","sourcesContent":["import {Injectable} from '@angular/core';\n\n@Injectable()\nexport class ValidaModulo11Service {\n\n /**\n * Método que verifica a validade de um CPF.\n *\n * @param cpf - String com CPF a ser validado.\n * @return True se CPF é válido e false caso contrário.\n */\n isValidCpf(cpf: string): boolean {\n if ((cpf.length === 11) && !this.isRepeatedNumber(cpf) &&\n (Number(cpf.charAt(9)) === this.calculateDvMod11(cpf, 9, 2, 11)) &&\n (Number(cpf.charAt(10)) === this.calculateDvMod11(cpf, 10, 2, 11))) {\n return true;\n }\n\n return false;\n }\n\n /**\n * <P>\n * Método que verifica a validade de um CGC (CNPJ).\n * Suporta o novo formato alfanumérico.\n * </p>\n * <P>\n * Um CGC é válido se tiver o seguinte formato: RRRRRRRRFFFFDD (tamanho 14), onde:\n * </p>\n * <UL>\n * <li>RRRRRRRR - Raiz do CGC;</li>\n * <li>FFFF - Filial;</li>\n * <li>DD - Dígito verificador.</li>\n * </ul>\n *\n * @param cgc - String com CGC a ser validado.\n * @return True se CGC é válido e false caso contrário.\n */\n isValidCgc(cgc: string): boolean {\n if (cgc.length !== 14 || this.isRepeatedNumber(cgc)) {\n return false;\n }\n\n const cgcUpper = cgc.toUpperCase();\n const weights1 = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];\n const weights2 = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];\n\n const dv1 = this.calculateCnpjDv(cgcUpper.substring(0, 12), weights1);\n const dv2 = this.calculateCnpjDv(cgcUpper.substring(0, 12) + dv1, weights2);\n\n return cgcUpper.endsWith(`${dv1}${dv2}`);\n }\n\n /**\n * Calcula o dígito verificador do CNPJ (numérico ou alfanumérico).\n * @param base A parte do CNPJ sobre a qual o DV será calculado.\n * @param weights Os pesos para o cálculo.\n * @private\n */\n private calculateCnpjDv(base: string, weights: number[]): number {\n let sum = 0;\n for (let i = 0; i < base.length; i++) {\n // Norma da Receita Federal (CNPJ alfanumérico): valor do caractere = código ASCII - 48\n // ('0'-'9' => 0..9; 'A'-'Z' => 17..42)\n const value = base.charCodeAt(i) - 48;\n\n sum += value * weights[i];\n }\n\n const remainder = sum % 11;\n return remainder < 2 ? 0 : 11 - remainder;\n }\n\n /**\n * Método que verifica se cadeia é composta apenas por caracteres numéricos repetidos (tudo 0 ou tudo 1, ...). Utilizado nas rotinas que\n * testam cpf e cgc.\n *\n * @param cadeia - Cadeia a ser checada.\n * @return True caso cadeia seja formado somente com dígitos e false caso contrário.\n */\n isRepeatedNumber(cadeia: string): boolean {\n let ind = 1;\n let ch = cadeia.charAt(0);\n\n while (ind < cadeia.length) {\n if (ch === cadeia.charAt(ind)) {\n ind++;\n } else {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Método que calcula o dígito verificador módulo 11 de uma cadeia.\n *\n * @param cadeia - Cadeia ser calculado o dígito verificador.\n * @param tam - Número de dígitos a serem utilizados no cálculo.\n * @param fatorInicial - Valor base no fator de multiplicação.\n * @param fatorFinal - Valor limite do fator de multiplicação.\n * @return Valor (decimal) do d�gito verificador.\n */\n calculateDvMod11(cadeia: string, tam: number, fatorInicial: number, fatorFinal: number): number {\n let fator = fatorInicial;\n let total = 0;\n\n for (let ind = 0; ind < tam; ind++) {\n total += Number(cadeia.charAt(tam - ind - 1)) * fator;\n fator++;\n\n if (fator > fatorFinal) {\n fator = fatorInicial;\n }\n }\n\n total %= 11;\n\n if (total < 2) {\n return 0;\n }\n\n return (11 - total);\n }\n\n\n}\n","import {Injectable} from '@angular/core';\nimport JSEncrypt from 'jsencrypt';\n\n@Injectable()\nexport class CriptografiaService {\n\n public criptografa(chavePublica: string, senha: string): string {\n const rsa = new JSEncrypt(undefined);\n rsa.setPublicKey(chavePublica);\n return rsa.encrypt(senha) as string;\n }\n\n}\n","import {Injectable} from '@angular/core';\nimport {MatSnackBar, MatSnackBarConfig, MatSnackBarHorizontalPosition, MatSnackBarVerticalPosition} from '@angular/material/snack-bar';\nimport {TranslateService} from '@ngx-translate/core';\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MensageriaService {\n\n defaultHorizontalPosition: MatSnackBarHorizontalPosition = 'right';\n defaultVerticalPosition: MatSnackBarVerticalPosition = 'top';\n defaultDuration = 2000;\n\n private $defaultComponent: any;\n\n constructor(\n private snackBar: MatSnackBar,\n private translateService: TranslateService,\n ) {\n }\n\n setDefaultComponent(defaultComponent: any) {\n this.$defaultComponent = defaultComponent;\n }\n\n addMensagemFromComponent(component: any, config?: MatSnackBarConfig) {\n this.snackBar.openFromComponent(component, {\n horizontalPosition: this.defaultHorizontalPosition,\n verticalPosition: this.defaultVerticalPosition,\n duration: this.defaultDuration,\n ...config,\n });\n }\n\n addMensagem(mensagem: string, args = {}, action = 'OK', config?: MatSnackBarConfig) {\n const parsedConfig = {\n horizontalPosition: this.defaultHorizontalPosition,\n verticalPosition: this.defaultVerticalPosition,\n duration: this.defaultDuration,\n ...config,\n };\n\n let ref;\n if (!!this.$defaultComponent) {\n ref = this.snackBar.openFromComponent(this.$defaultComponent,\n {\n ...parsedConfig,\n data: {\n message: this.translateService.instant(mensagem, args),\n data: parsedConfig.data,\n },\n });\n } else {\n ref = this.snackBar.open(this.translateService.instant(mensagem, args), 'OK', parsedConfig);\n }\n\n ref.onAction().subscribe(() => {\n ref.dismiss();\n });\n }\n}\n","import {Injectable} from '@angular/core';\nimport {MediaMatcher} from '@angular/cdk/layout';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MobileService {\n mobileQuery: MediaQueryList;\n tabletQuery: MediaQueryList;\n\n private mobileQueryListener: () => void;\n\n private listeners = [];\n\n constructor(\n media: MediaMatcher\n ) {\n this.mobileQuery = media.matchMedia('(max-width: 600px)');\n this.tabletQuery = media.matchMedia('(max-width: 950px)');\n\n this.mobileQueryListener = () => {\n this.listeners.forEach(listener => {\n try {\n listener(this.mobile, this.tablet);\n } catch (e) {\n console.error(e);\n }\n });\n };\n\n this.mobileQuery.addEventListener('change', this.mobileQueryListener);\n this.tabletQuery.addEventListener('change', this.mobileQueryListener);\n }\n\n addListener(listener: (mobile: boolean, tablet?: boolean) => void) {\n this.listeners.push(listener);\n }\n\n removeListener(listener: (mobile: boolean, tablet?: boolean) => void) {\n this.listeners.splice(this.listeners.indexOf(listener), 1);\n }\n\n get mobile() {\n return this.mobileQuery.matches;\n }\n\n get tablet() {\n return this.tabletQuery.matches;\n }\n\n}\n","import {ModuleWithProviders, NgModule} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {ValidaModulo11Service} from './validator/valida-modulo11.service';\nimport {CriptografiaService} from './criptografia/criptografia.service';\nimport {MensageriaService} from './mensageria/mensageria.service';\nimport {MobileService} from './mobile/mobile.service';\n\n\n@NgModule({\n imports: [\n CommonModule,\n ]\n})\nexport class CoreModule {\n\n static forRoot(): ModuleWithProviders<CoreModule> {\n return {\n ngModule: CoreModule,\n providers: [\n ValidaModulo11Service,\n CriptografiaService,\n MensageriaService,\n MobileService,\n ]\n };\n }\n\n}\n"]}
@@ -50,8 +50,8 @@
50
50
  DialogConfirmacaoComponent.decorators = [
51
51
  { type: i0.Component, args: [{
52
52
  selector: 'mcl-dialog-confirmacao',
53
- template: "<div mat-dialog-title>\n {{titulo | translate}}\n</div>\n\n<form (ngSubmit)=\"confirma(form)\" #form=\"ngForm\">\n <div mat-dialog-content>\n\n <p [innerHTML]=\"mensagem | translate\"></p>\n\n </div>\n\n <div mat-dialog-actions>\n <button mat-stroked-button color=\"accent\">\n {{okLabel | translate}}\n </button>\n <button mat-flat-button color=\"warn\" type=\"button\" mat-dialog-close *ngIf=\"cancelLabel\">\n {{cancelLabel | translate}}\n </button>\n </div>\n</form>\n",
54
- styles: [".mat-dialog-content{width:95vw;max-width:280px;min-width:auto;margin:10px 60px;text-align:center;min-height:120px;display:flex;flex-direction:column;justify-content:center}[mat-dialog-title]{text-align:center;margin:40px 60px 20px}[mat-dialog-actions]{justify-content:center;margin:20px 60px 40px;flex-direction:row}@media (max-width:750px){.mat-dialog-content{margin:10px 20px}}"]
53
+ template: "<div mat-dialog-title>\n {{titulo | translate}}\n</div>\n\n<form (ngSubmit)=\"confirma(form)\" #form=\"ngForm\">\n <div mat-dialog-content>\n\n <p [innerHTML]=\"mensagem | translate\"></p>\n\n </div>\n\n <div mat-dialog-actions>\n <button mat-button type=\"button\" mat-dialog-close *ngIf=\"cancelLabel\">\n {{cancelLabel | translate}}\n </button>\n <button mat-flat-button color=\"accent\">\n {{okLabel | translate}}\n </button>\n </div>\n</form>\n",
54
+ styles: [":host{display:block;min-width:300px;max-width:420px}.mat-dialog-content{width:auto;max-width:none;min-width:auto;min-height:0;text-align:left;line-height:1.5}[mat-dialog-title]{text-align:left}[mat-dialog-actions]{justify-content:flex-end;flex-direction:row;gap:8px}@media (max-width:750px){:host{min-width:0;max-width:85vw}}"]
55
55
  },] }
56
56
  ];
57
57
  DialogConfirmacaoComponent.ctorParameters = function () { return [
@@ -1 +1 @@
1
- {"version":3,"file":"main-class-componentes-dialog.umd.js","sources":["../../../../projects/main-class/componentes/dialog/src/dialog-confirmacao/dialog-confirmacao.component.ts","../../../../projects/main-class/componentes/dialog/src/dialog-iframe/dialog-iframe.component.ts","../../../../projects/main-class/componentes/dialog/src/dialog.service.ts","../../../../projects/main-class/componentes/dialog/src/dialog.module.ts","../../../../projects/main-class/componentes/dialog/main-class-componentes-dialog.ts"],"sourcesContent":["import {Component, Inject, OnInit} from '@angular/core';\nimport {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';\nimport {NgForm} from '@angular/forms';\n\nexport interface DialogConfirmacaoData {\n titulo: string;\n mensagem: string;\n okLabel: string;\n cancelLabel?: string;\n}\n\n@Component({\n selector: 'mcl-dialog-confirmacao',\n templateUrl: './dialog-confirmacao.component.html',\n styleUrls: ['./dialog-confirmacao.component.scss']\n})\nexport class DialogConfirmacaoComponent implements OnInit {\n\n constructor(\n @Inject(MAT_DIALOG_DATA) private data: DialogConfirmacaoData,\n private dialogRef: MatDialogRef<any>,\n ) {\n }\n\n get titulo() {\n return this.data.titulo;\n }\n\n get mensagem() {\n return this.data.mensagem;\n }\n\n get okLabel() {\n return this.data.okLabel;\n }\n\n get cancelLabel() {\n return this.data.cancelLabel;\n }\n\n ngOnInit(): void {\n }\n\n confirma(form: NgForm) {\n if (!form.valid) {\n return;\n }\n\n this.dialogRef.close(true);\n }\n}\n","import {AfterViewInit, Component, ElementRef, Inject, ViewChild} from '@angular/core';\nimport {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';\nimport {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';\n\nexport interface DialogIframData {\n url: string;\n titulo: string;\n}\n\n@Component({\n selector: 'mcl-dialog-iframe',\n templateUrl: './dialog-iframe.component.html',\n styleUrls: ['./dialog-iframe.component.scss']\n})\nexport class DialogIframeComponent implements AfterViewInit {\n\n titulo: string;\n url: SafeResourceUrl;\n\n @ViewChild('iframe') iframe: ElementRef;\n\n constructor(\n @Inject(MAT_DIALOG_DATA) dados: DialogIframData,\n private dialogRef: MatDialogRef<any>,\n sanitizer: DomSanitizer,\n ) {\n this.titulo = dados.titulo;\n this.url = sanitizer.bypassSecurityTrustResourceUrl(dados.url);\n }\n\n ngAfterViewInit() {\n registerDialogOnIframe(this.iframe.nativeElement, () => this.close());\n }\n\n private returnValue() {\n const fraContent = this.iframe.nativeElement.contentDocument ||\n this.iframe.nativeElement.contentWindow?.document;\n\n if (fraContent) {\n const divRetornoValue = fraContent.getElementById('returnValue');\n\n if (divRetornoValue) {\n const returnValue = divRetornoValue.innerText;\n\n if (returnValue) {\n return JSON.parse(returnValue);\n }\n }\n }\n\n return undefined;\n }\n\n close() {\n this.dialogRef.close(this.returnValue());\n }\n}\n\nfunction registerDialogOnIframe(iframe, callback) {\n window.addEventListener('dialogIframeClosed', () => callback());\n}\n\nexport function closeDialogIframe(returnValue?: any) {\n if (returnValue) {\n const returnDiv = document.createElement('div');\n\n returnDiv.id = 'returnValue';\n returnDiv.innerText = JSON.stringify(returnValue);\n returnDiv.style.display = 'none';\n\n document.body.appendChild(returnDiv);\n }\n\n window.parent.dispatchEvent(new Event('dialogIframeClosed'));\n}\n","import {Injectable} from '@angular/core';\nimport {Observable} from 'rxjs';\nimport {MatDialog} from '@angular/material/dialog';\nimport {DialogConfirmacaoComponent, DialogConfirmacaoData} from './dialog-confirmacao/dialog-confirmacao.component';\nimport {map} from 'rxjs/operators';\nimport {DialogIframeComponent} from './dialog-iframe/dialog-iframe.component';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DialogService {\n\n constructor(\n private dialog: MatDialog\n ) {\n }\n\n confirma(mensagem: string, config: {\n icon?: string,\n titulo?: string,\n okLabel?: string,\n cancelLabel?: string\n } = {}): Observable<boolean> {\n return this.dialog.open<DialogConfirmacaoComponent, DialogConfirmacaoData, boolean>(DialogConfirmacaoComponent, {\n data: {\n titulo: config.titulo || 'mcl.dialog.confirmacao',\n mensagem,\n okLabel: config.okLabel || 'mcl.dialog.sim',\n cancelLabel: config.cancelLabel || 'mcl.dialog.nao'\n }\n }).afterClosed().pipe(map(result => !!result));\n }\n\n informa(mensagem: string, config: {\n icon?: string,\n titulo?: string,\n okLabel?: string\n } = {}): Observable<boolean> {\n return this.dialog.open<DialogConfirmacaoComponent, DialogConfirmacaoData, boolean>(DialogConfirmacaoComponent, {\n data: {\n titulo: config.titulo || 'mcl.dialog.informacao',\n mensagem,\n okLabel: config.okLabel || 'mcl.dialog.ok',\n }\n }).afterClosed().pipe(map(result => !!result));\n }\n\n iframe(url: string, titulo: string): Observable<any> {\n if (!!window.parent && window.parent !== window) {\n window.location.href = url;\n } else {\n return this.dialog.open(DialogIframeComponent, {\n data: {\n titulo,\n url,\n },\n panelClass: 'dialog-frame',\n }).afterClosed();\n }\n }\n}\n","import {ModuleWithProviders, NgModule} from '@angular/core';\nimport {DialogConfirmacaoComponent} from './dialog-confirmacao/dialog-confirmacao.component';\nimport {DialogIframeComponent} from './dialog-iframe/dialog-iframe.component';\nimport {CommonModule} from '@angular/common';\nimport {TranslateModule} from '@ngx-translate/core';\nimport {MatButtonModule} from '@angular/material/button';\nimport {FormsModule} from '@angular/forms';\nimport {MatIconModule} from '@angular/material/icon';\nimport {MatDialogModule} from '@angular/material/dialog';\nimport {DialogService} from './dialog.service';\n\n\n@NgModule({\n declarations: [\n DialogConfirmacaoComponent,\n DialogIframeComponent,\n ],\n imports: [\n CommonModule,\n TranslateModule,\n MatButtonModule,\n FormsModule,\n MatIconModule,\n MatDialogModule,\n ]\n})\nexport class DialogModule {\n\n static forRoot(): ModuleWithProviders<DialogModule> {\n return {\n ngModule: DialogModule,\n providers: [\n DialogService\n ]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["Component","Inject","MAT_DIALOG_DATA","MatDialogRef","DomSanitizer","ViewChild","map","Injectable","MatDialog","NgModule","CommonModule","TranslateModule","MatButtonModule","FormsModule","MatIconModule","MatDialogModule"],"mappings":";;;;;;;QAkBE,oCACmC,IAA2B,EACpD,SAA4B;YADH,SAAI,GAAJ,IAAI,CAAuB;YACpD,cAAS,GAAT,SAAS,CAAmB;SAErC;QAED,sBAAI,8CAAM;iBAAV;gBACE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;aACzB;;;WAAA;QAED,sBAAI,gDAAQ;iBAAZ;gBACE,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;aAC3B;;;WAAA;QAED,sBAAI,+CAAO;iBAAX;gBACE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;aAC1B;;;WAAA;QAED,sBAAI,mDAAW;iBAAf;gBACE,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;aAC9B;;;WAAA;QAED,6CAAQ,GAAR;SACC;QAED,6CAAQ,GAAR,UAAS,IAAY;YACnB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;gBACf,OAAO;aACR;YAED,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAC5B;;;;gBAtCFA,YAAS,SAAC;oBACT,QAAQ,EAAE,wBAAwB;oBAClC,kgBAAkD;;iBAEnD;;;gDAIIC,SAAM,SAACC,kBAAe;gBAlBFC,eAAY;;;;QCoBnC,+BAC2B,KAAsB,EACvC,SAA4B,EACpC,SAAuB;YADf,cAAS,GAAT,SAAS,CAAmB;YAGpC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YAC3B,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,8BAA8B,CAAC,KAAK,CAAC,GA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AAN,UAAO,GAAW,EAAE,MAAc;YAChC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC/C,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC;aAC5B;iBAAM;gBACL,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE;oBAC7C,IAAI,EAAE;wBACJ,MAAM,QAAA;wBACN,GAAG,KAAA;qBACJ;oBACD,UAAU,EAAE,cAAc;iBAC3B,CAAC,CAAC,WAAW,EAAE,CAAC;aAClB;SACF;;;;;gBApDFC,aAAU,SAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;gBAPOC,YAAS;;;;QCwBjB;;QAES,oBAAO,GAAd;YACE,OAAO;gBACL,QAAQ,EAAE,YAAY;gBACtB,SAAS,EAAE;oBACT,aAAa;iBACd;aACF,CAAC;SACH;;;;gBAvBFC,WAAQ,SAAC;oBACR,YAAY,EAAE;wBACZ,0BAA0B;wBAC1B,qBAAqB;qBACtB;oBACD,OAAO,EAAE;wBACPC,mBAAY;wBACZC,oBAAe;wBACfC,sBAAe;wBACfC,iBAAW;wBACXC,kBAAa;wBACbC,kBAAe;qBAChB;iBACF;;;ICzBD;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"main-class-componentes-dialog.umd.js","sources":["../../../../projects/main-class/componentes/dialog/src/dialog-confirmacao/dialog-confirmacao.component.ts","../../../../projects/main-class/componentes/dialog/src/dialog-iframe/dialog-iframe.component.ts","../../../../projects/main-class/componentes/dialog/src/dialog.service.ts","../../../../projects/main-class/componentes/dialog/src/dialog.module.ts","../../../../projects/main-class/componentes/dialog/main-class-componentes-dialog.ts"],"sourcesContent":["import {Component, Inject, OnInit} from '@angular/core';\nimport {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';\nimport {NgForm} from '@angular/forms';\n\nexport interface DialogConfirmacaoData {\n titulo: string;\n mensagem: string;\n okLabel: string;\n cancelLabel?: string;\n}\n\n@Component({\n selector: 'mcl-dialog-confirmacao',\n templateUrl: './dialog-confirmacao.component.html',\n styleUrls: ['./dialog-confirmacao.component.scss']\n})\nexport class DialogConfirmacaoComponent implements OnInit {\n\n constructor(\n @Inject(MAT_DIALOG_DATA) private data: DialogConfirmacaoData,\n private dialogRef: MatDialogRef<any>,\n ) {\n }\n\n get titulo() {\n return this.data.titulo;\n }\n\n get mensagem() {\n return this.data.mensagem;\n }\n\n get okLabel() {\n return this.data.okLabel;\n }\n\n get cancelLabel() {\n return this.data.cancelLabel;\n }\n\n ngOnInit(): void {\n }\n\n confirma(form: NgForm) {\n if (!form.valid) {\n return;\n }\n\n this.dialogRef.close(true);\n }\n}\n","import {AfterViewInit, Component, ElementRef, Inject, ViewChild} from '@angular/core';\nimport {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';\nimport {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';\n\nexport interface DialogIframData {\n url: string;\n titulo: string;\n}\n\n@Component({\n selector: 'mcl-dialog-iframe',\n templateUrl: './dialog-iframe.component.html',\n styleUrls: ['./dialog-iframe.component.scss']\n})\nexport class DialogIframeComponent implements AfterViewInit {\n\n titulo: string;\n url: SafeResourceUrl;\n\n @ViewChild('iframe') iframe: ElementRef;\n\n constructor(\n @Inject(MAT_DIALOG_DATA) dados: DialogIframData,\n private dialogRef: MatDialogRef<any>,\n sanitizer: DomSanitizer,\n ) {\n this.titulo = dados.titulo;\n this.url = sanitizer.bypassSecurityTrustResourceUrl(dados.url);\n }\n\n ngAfterViewInit() {\n registerDialogOnIframe(this.iframe.nativeElement, () => this.close());\n }\n\n private returnValue() {\n const fraContent = this.iframe.nativeElement.contentDocument ||\n this.iframe.nativeElement.contentWindow?.document;\n\n if (fraContent) {\n const divRetornoValue = fraContent.getElementById('returnValue');\n\n if (divRetornoValue) {\n const returnValue = divRetornoValue.innerText;\n\n if (returnValue) {\n return JSON.parse(returnValue);\n }\n }\n }\n\n return undefined;\n }\n\n close() {\n this.dialogRef.close(this.returnValue());\n }\n}\n\nfunction registerDialogOnIframe(iframe, callback) {\n window.addEventListener('dialogIframeClosed', () => callback());\n}\n\nexport function closeDialogIframe(returnValue?: any) {\n if (returnValue) {\n const returnDiv = document.createElement('div');\n\n returnDiv.id = 'returnValue';\n returnDiv.innerText = JSON.stringify(returnValue);\n returnDiv.style.display = 'none';\n\n document.body.appendChild(returnDiv);\n }\n\n window.parent.dispatchEvent(new Event('dialogIframeClosed'));\n}\n","import {Injectable} from '@angular/core';\nimport {Observable} from 'rxjs';\nimport {MatDialog} from '@angular/material/dialog';\nimport {DialogConfirmacaoComponent, DialogConfirmacaoData} from './dialog-confirmacao/dialog-confirmacao.component';\nimport {map} from 'rxjs/operators';\nimport {DialogIframeComponent} from './dialog-iframe/dialog-iframe.component';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DialogService {\n\n constructor(\n private dialog: MatDialog\n ) {\n }\n\n confirma(mensagem: string, config: {\n icon?: string,\n titulo?: string,\n okLabel?: string,\n cancelLabel?: string\n } = {}): Observable<boolean> {\n return this.dialog.open<DialogConfirmacaoComponent, DialogConfirmacaoData, boolean>(DialogConfirmacaoComponent, {\n data: {\n titulo: config.titulo || 'mcl.dialog.confirmacao',\n mensagem,\n okLabel: config.okLabel || 'mcl.dialog.sim',\n cancelLabel: config.cancelLabel || 'mcl.dialog.nao'\n }\n }).afterClosed().pipe(map(result => !!result));\n }\n\n informa(mensagem: string, config: {\n icon?: string,\n titulo?: string,\n okLabel?: string\n } = {}): Observable<boolean> {\n return this.dialog.open<DialogConfirmacaoComponent, DialogConfirmacaoData, boolean>(DialogConfirmacaoComponent, {\n data: {\n titulo: config.titulo || 'mcl.dialog.informacao',\n mensagem,\n okLabel: config.okLabel || 'mcl.dialog.ok',\n }\n }).afterClosed().pipe(map(result => !!result));\n }\n\n iframe(url: string, titulo: string): Observable<any> {\n if (!!window.parent && window.parent !== window) {\n window.location.href = url;\n } else {\n return this.dialog.open(DialogIframeComponent, {\n data: {\n titulo,\n url,\n },\n panelClass: 'dialog-frame',\n }).afterClosed();\n }\n }\n}\n","import {ModuleWithProviders, NgModule} from '@angular/core';\nimport {DialogConfirmacaoComponent} from './dialog-confirmacao/dialog-confirmacao.component';\nimport {DialogIframeComponent} from './dialog-iframe/dialog-iframe.component';\nimport {CommonModule} from '@angular/common';\nimport {TranslateModule} from '@ngx-translate/core';\nimport {MatButtonModule} from '@angular/material/button';\nimport {FormsModule} from '@angular/forms';\nimport {MatIconModule} from '@angular/material/icon';\nimport {MatDialogModule} from '@angular/material/dialog';\nimport {DialogService} from './dialog.service';\n\n\n@NgModule({\n declarations: [\n DialogConfirmacaoComponent,\n DialogIframeComponent,\n ],\n imports: [\n CommonModule,\n TranslateModule,\n MatButtonModule,\n FormsModule,\n MatIconModule,\n MatDialogModule,\n ]\n})\nexport class DialogModule {\n\n static forRoot(): ModuleWithProviders<DialogModule> {\n return {\n ngModule: DialogModule,\n providers: [\n DialogService\n ]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["Component","Inject","MAT_DIALOG_DATA","MatDialogRef","DomSanitizer","ViewChild","map","Injectable","MatDialog","NgModule","CommonModule","TranslateModule","MatButtonModule","FormsModule","MatIconModule","MatDialogModule"],"mappings":";;;;;;;QAkBE,oCACmC,IAA2B,EACpD,SAA4B;YADH,SAAI,GAAJ,IAAI,CAAuB;YACpD,cAAS,GAAT,SAAS,CAAmB;SAErC;QAED,sBAAI,8CAAM;iBAAV;gBACE,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;aACzB;;;WAAA;QAED,sBAAI,gDAAQ;iBAAZ;gBACE,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;aAC3B;;;WAAA;QAED,sBAAI,+CAAO;iBAAX;gBACE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;aAC1B;;;WAAA;QAED,sBAAI,mDAAW;iBAAf;gBACE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qBACtB;oBACD,OAAO,EAAE;wBACPC,mBAAY;wBACZC,oBAAe;wBACfC,sBAAe;wBACfC,iBAAW;wBACXC,kBAAa;wBACbC,kBAAe;qBAChB;iBACF;;;ICzBD;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/material/dialog"),require("@angular/platform-browser"),require("@angular/common"),require("@ngx-translate/core"),require("@angular/material/button"),require("@angular/forms"),require("@angular/material/icon"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@main-class/componentes/dialog",["exports","@angular/core","@angular/material/dialog","@angular/platform-browser","@angular/common","@ngx-translate/core","@angular/material/button","@angular/forms","@angular/material/icon","rxjs/operators"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["main-class"]=t["main-class"]||{},t["main-class"].componentes=t["main-class"].componentes||{},t["main-class"].componentes.dialog={}),t.ng.core,t.ng.material.dialog,t.ng.platformBrowser,t.ng.common,t.core,t.ng.material.button,t.ng.forms,t.ng.material.icon,t.rxjs.operators)}(this,(function(t,e,n,o,a,r,i,l,c,u){"use strict";var d=function(){function t(t,e){this.data=t,this.dialogRef=e}return Object.defineProperty(t.prototype,"titulo",{get:function(){return this.data.titulo},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mensagem",{get:function(){return this.data.mensagem},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"okLabel",{get:function(){return this.data.okLabel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cancelLabel",{get:function(){return this.data.cancelLabel},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){},t.prototype.confirma=function(t){t.valid&&this.dialogRef.close(!0)},t}();d.decorators=[{type:e.Component,args:[{selector:"mcl-dialog-confirmacao",template:'<div mat-dialog-title>\n {{titulo | translate}}\n</div>\n\n<form (ngSubmit)="confirma(form)" #form="ngForm">\n <div mat-dialog-content>\n\n <p [innerHTML]="mensagem | translate"></p>\n\n </div>\n\n <div mat-dialog-actions>\n <button mat-stroked-button color="accent">\n {{okLabel | translate}}\n </button>\n <button mat-flat-button color="warn" type="button" mat-dialog-close *ngIf="cancelLabel">\n {{cancelLabel | translate}}\n </button>\n </div>\n</form>\n',styles:[".mat-dialog-content{width:95vw;max-width:280px;min-width:auto;margin:10px 60px;text-align:center;min-height:120px;display:flex;flex-direction:column;justify-content:center}[mat-dialog-title]{text-align:center;margin:40px 60px 20px}[mat-dialog-actions]{justify-content:center;margin:20px 60px 40px;flex-direction:row}@media (max-width:750px){.mat-dialog-content{margin:10px 20px}}"]}]}],d.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[n.MAT_DIALOG_DATA]}]},{type:n.MatDialogRef}]};var m=function(){function t(t,e,n){this.dialogRef=e,this.titulo=t.titulo,this.url=n.bypassSecurityTrustResourceUrl(t.url)}return t.prototype.ngAfterViewInit=function(){var t,e=this;this.iframe.nativeElement,t=function(){return e.close()},window.addEventListener("dialogIframeClosed",(function(){return t()}))},t.prototype.returnValue=function(){var t,e=this.iframe.nativeElement.contentDocument||(null===(t=this.iframe.nativeElement.contentWindow)||void 0===t?void 0:t.document);if(e){var n=e.getElementById("returnValue");if(n){var o=n.innerText;if(o)return JSON.parse(o)}}},t.prototype.close=function(){this.dialogRef.close(this.returnValue())},t}();m.decorators=[{type:e.Component,args:[{selector:"mcl-dialog-iframe",template:'<div mat-dialog-title >\n <h2>{{titulo}}</h2>\n <button mat-icon-button mat-dialog-close class="pull-right" tabindex="-1">\n <mat-icon>close</mat-icon>\n </button>\n</div>\n<div mat-dialog-content>\n <iframe #iframe width="560" height="315" [src]="url" (close)="close()" frameborder="0"\n ></iframe>\n</div>\n',styles:["[mat-dialog-title]{display:flex}[mat-dialog-title] h2{font-size:25px;flex:1 1 auto;margin:0 0 20px}[mat-dialog-title] mat-icon{vertical-align:middle}mat-dialog-content{margin:-24px;width:calc(100% + 48px);padding:0}mat-dialog-content iframe{width:100%;height:60vh;border:0}"]}]}],m.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[n.MAT_DIALOG_DATA]}]},{type:n.MatDialogRef},{type:o.DomSanitizer}]},m.propDecorators={iframe:[{type:e.ViewChild,args:["iframe"]}]};var s=function(){function t(t){this.dialog=t}return t.prototype.confirma=function(t,e){return void 0===e&&(e={}),this.dialog.open(d,{data:{titulo:e.titulo||"mcl.dialog.confirmacao",mensagem:t,okLabel:e.okLabel||"mcl.dialog.sim",cancelLabel:e.cancelLabel||"mcl.dialog.nao"}}).afterClosed().pipe(u.map((function(t){return!!t})))},t.prototype.informa=function(t,e){return void 0===e&&(e={}),this.dialog.open(d,{data:{titulo:e.titulo||"mcl.dialog.informacao",mensagem:t,okLabel:e.okLabel||"mcl.dialog.ok"}}).afterClosed().pipe(u.map((function(t){return!!t})))},t.prototype.iframe=function(t,e){if(!window.parent||window.parent===window)return this.dialog.open(m,{data:{titulo:e,url:t},panelClass:"dialog-frame"}).afterClosed();window.location.href=t},t}();s.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new s(e.ɵɵinject(n.MatDialog))},token:s,providedIn:"root"}),s.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],s.ctorParameters=function(){return[{type:n.MatDialog}]};var f=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[s]}},t}();f.decorators=[{type:e.NgModule,args:[{declarations:[d,m],imports:[a.CommonModule,r.TranslateModule,i.MatButtonModule,l.FormsModule,c.MatIconModule,n.MatDialogModule]}]}],t.DialogConfirmacaoComponent=d,t.DialogIframeComponent=m,t.DialogModule=f,t.DialogService=s,t.closeDialogIframe=function(t){if(t){var e=document.createElement("div");e.id="returnValue",e.innerText=JSON.stringify(t),e.style.display="none",document.body.appendChild(e)}window.parent.dispatchEvent(new Event("dialogIframeClosed"))},Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/material/dialog"),require("@angular/platform-browser"),require("@angular/common"),require("@ngx-translate/core"),require("@angular/material/button"),require("@angular/forms"),require("@angular/material/icon"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@main-class/componentes/dialog",["exports","@angular/core","@angular/material/dialog","@angular/platform-browser","@angular/common","@ngx-translate/core","@angular/material/button","@angular/forms","@angular/material/icon","rxjs/operators"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["main-class"]=t["main-class"]||{},t["main-class"].componentes=t["main-class"].componentes||{},t["main-class"].componentes.dialog={}),t.ng.core,t.ng.material.dialog,t.ng.platformBrowser,t.ng.common,t.core,t.ng.material.button,t.ng.forms,t.ng.material.icon,t.rxjs.operators)}(this,(function(t,e,o,n,a,i,r,l,c,u){"use strict";var d=function(){function t(t,e){this.data=t,this.dialogRef=e}return Object.defineProperty(t.prototype,"titulo",{get:function(){return this.data.titulo},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mensagem",{get:function(){return this.data.mensagem},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"okLabel",{get:function(){return this.data.okLabel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cancelLabel",{get:function(){return this.data.cancelLabel},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){},t.prototype.confirma=function(t){t.valid&&this.dialogRef.close(!0)},t}();d.decorators=[{type:e.Component,args:[{selector:"mcl-dialog-confirmacao",template:'<div mat-dialog-title>\n {{titulo | translate}}\n</div>\n\n<form (ngSubmit)="confirma(form)" #form="ngForm">\n <div mat-dialog-content>\n\n <p [innerHTML]="mensagem | translate"></p>\n\n </div>\n\n <div mat-dialog-actions>\n <button mat-button type="button" mat-dialog-close *ngIf="cancelLabel">\n {{cancelLabel | translate}}\n </button>\n <button mat-flat-button color="accent">\n {{okLabel | translate}}\n </button>\n </div>\n</form>\n',styles:[":host{display:block;min-width:300px;max-width:420px}.mat-dialog-content{width:auto;max-width:none;min-width:auto;min-height:0;text-align:left;line-height:1.5}[mat-dialog-title]{text-align:left}[mat-dialog-actions]{justify-content:flex-end;flex-direction:row;gap:8px}@media (max-width:750px){:host{min-width:0;max-width:85vw}}"]}]}],d.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[o.MAT_DIALOG_DATA]}]},{type:o.MatDialogRef}]};var m=function(){function t(t,e,o){this.dialogRef=e,this.titulo=t.titulo,this.url=o.bypassSecurityTrustResourceUrl(t.url)}return t.prototype.ngAfterViewInit=function(){var t,e=this;this.iframe.nativeElement,t=function(){return e.close()},window.addEventListener("dialogIframeClosed",(function(){return t()}))},t.prototype.returnValue=function(){var t,e=this.iframe.nativeElement.contentDocument||(null===(t=this.iframe.nativeElement.contentWindow)||void 0===t?void 0:t.document);if(e){var o=e.getElementById("returnValue");if(o){var n=o.innerText;if(n)return JSON.parse(n)}}},t.prototype.close=function(){this.dialogRef.close(this.returnValue())},t}();m.decorators=[{type:e.Component,args:[{selector:"mcl-dialog-iframe",template:'<div mat-dialog-title >\n <h2>{{titulo}}</h2>\n <button mat-icon-button mat-dialog-close class="pull-right" tabindex="-1">\n <mat-icon>close</mat-icon>\n </button>\n</div>\n<div mat-dialog-content>\n <iframe #iframe width="560" height="315" [src]="url" (close)="close()" frameborder="0"\n ></iframe>\n</div>\n',styles:["[mat-dialog-title]{display:flex}[mat-dialog-title] h2{font-size:25px;flex:1 1 auto;margin:0 0 20px}[mat-dialog-title] mat-icon{vertical-align:middle}mat-dialog-content{margin:-24px;width:calc(100% + 48px);padding:0}mat-dialog-content iframe{width:100%;height:60vh;border:0}"]}]}],m.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[o.MAT_DIALOG_DATA]}]},{type:o.MatDialogRef},{type:n.DomSanitizer}]},m.propDecorators={iframe:[{type:e.ViewChild,args:["iframe"]}]};var s=function(){function t(t){this.dialog=t}return t.prototype.confirma=function(t,e){return void 0===e&&(e={}),this.dialog.open(d,{data:{titulo:e.titulo||"mcl.dialog.confirmacao",mensagem:t,okLabel:e.okLabel||"mcl.dialog.sim",cancelLabel:e.cancelLabel||"mcl.dialog.nao"}}).afterClosed().pipe(u.map((function(t){return!!t})))},t.prototype.informa=function(t,e){return void 0===e&&(e={}),this.dialog.open(d,{data:{titulo:e.titulo||"mcl.dialog.informacao",mensagem:t,okLabel:e.okLabel||"mcl.dialog.ok"}}).afterClosed().pipe(u.map((function(t){return!!t})))},t.prototype.iframe=function(t,e){if(!window.parent||window.parent===window)return this.dialog.open(m,{data:{titulo:e,url:t},panelClass:"dialog-frame"}).afterClosed();window.location.href=t},t}();s.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new s(e.ɵɵinject(o.MatDialog))},token:s,providedIn:"root"}),s.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],s.ctorParameters=function(){return[{type:o.MatDialog}]};var f=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[s]}},t}();f.decorators=[{type:e.NgModule,args:[{declarations:[d,m],imports:[a.CommonModule,i.TranslateModule,r.MatButtonModule,l.FormsModule,c.MatIconModule,o.MatDialogModule]}]}],t.DialogConfirmacaoComponent=d,t.DialogIframeComponent=m,t.DialogModule=f,t.DialogService=s,t.closeDialogIframe=function(t){if(t){var e=document.createElement("div");e.id="returnValue",e.innerText=JSON.stringify(t),e.style.display="none",document.body.appendChild(e)}window.parent.dispatchEvent(new Event("dialogIframeClosed"))},Object.defineProperty(t,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=main-class-componentes-dialog.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../projects/main-class/componentes/dialog/src/dialog-confirmacao/dialog-confirmacao.component.ts","../../../../projects/main-class/componentes/dialog/src/dialog-iframe/dialog-iframe.component.ts","../../../../projects/main-class/componentes/dialog/src/dialog.service.ts","../../../../projects/main-class/componentes/dialog/src/dialog.module.ts"],"names":["DialogConfirmacaoComponent","data","dialogRef","this","Object","defineProperty","prototype","titulo","mensagem","okLabel","cancelLabel","ngOnInit","confirma","form","valid","close","Component","args","selector","template","Inject","MAT_DIALOG_DATA","MatDialogRef","DialogIframeComponent","dados","sanitizer","url","bypassSecurityTrustResourceUrl","ngAfterViewInit","callback","_this","iframe","nativeElement","window","addEventListener","returnValue","fraContent","contentDocument","_a","contentWindow","document","divRetornoValue","getElementById","innerText","JSON","parse","DomSanitizer","ViewChild","DialogService","dialog","config","open","afterClosed","pipe","map","result","informa","parent","panelClass","location","href","Injectable","providedIn","MatDialog","DialogModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","TranslateModule","MatButtonModule","FormsModule","MatIconModule","MatDialogModule","returnDiv","createElement","id","stringify","style","display","body","appendChild","dispatchEvent","Event"],"mappings":"ohCAkBE,SAAAA,EACmCC,EACzBC,GADyBC,KAAAF,KAAAA,EACzBE,KAAAD,UAAAA,SAIVE,OAAAC,eAAIL,EAAAM,UAAA,SAAM,KAAV,WACE,OAAOH,KAAKF,KAAKM,wCAGnBH,OAAAC,eAAIL,EAAAM,UAAA,WAAQ,KAAZ,WACE,OAAOH,KAAKF,KAAKO,0CAGnBJ,OAAAC,eAAIL,EAAAM,UAAA,UAAO,KAAX,WACE,OAAOH,KAAKF,KAAKQ,yCAGnBL,OAAAC,eAAIL,EAAAM,UAAA,cAAW,KAAf,WACE,OAAOH,KAAKF,KAAKS,6CAGnBV,EAAAM,UAAAK,SAAA,aAGAX,EAAAM,UAAAM,SAAA,SAASC,GACFA,EAAKC,OAIVX,KAAKD,UAAUa,OAAM,6BArCxBC,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,yBACVC,SAAA,w7BAMGC,EAAAA,OAAMH,KAAA,CAACI,EAAAA,0BAlBaC,EAAAA,iCCoBvB,SAAAC,EAC2BC,EACjBtB,EACRuB,GADQtB,KAAAD,UAAAA,EAGRC,KAAKI,OAASiB,EAAMjB,OACpBJ,KAAKuB,IAAMD,EAAUE,+BAA+BH,EAAME,YAG5DH,EAAAjB,UAAAsB,gBAAA,WAAA,IA4BsCC,EA5BtCC,EAAA3B,KACyBA,KAAK4B,OAAOC,cA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AU,QAAEA,OAGxCP,EAAA1C,UAAAyB,OAAA,SAAOL,EAAanB,GAClB,IAAM0B,OAAOwB,QAAUxB,OAAOwB,SAAWxB,OAGvC,OAAO9B,KAAK8C,OAAOE,KAAK5B,EAAuB,CAC7CtB,KAAM,CACJM,OAAMA,EACNmB,IAAGA,GAELgC,WAAY,iBACXN,cARHnB,OAAO0B,SAASC,KAAOlC,gJA1C5BmC,EAAAA,WAAU5C,KAAA,CAAC,CACV6C,WAAY,oDANNC,EAAAA,8BCwBR,SAAAC,YAESA,EAAAC,QAAP,WACE,MAAO,CACLC,SAAUF,EACVG,UAAW,CACTnB,8BApBPoB,EAAAA,SAAQnD,KAAA,CAAC,CACRoD,aAAc,CACZrE,EACAuB,GAEF+C,QAAS,CACPC,EAAAA,aACAC,EAAAA,gBACAC,EAAAA,gBACAC,EAAAA,YACAC,EAAAA,cACAC,EAAAA,8IFuC8BzC,GAChC,GAAIA,EAAa,CACf,IAAM0C,EAAYrC,SAASsC,cAAc,OAEzCD,EAAUE,GAAK,cACfF,EAAUlC,UAAYC,KAAKoC,UAAU7C,GACrC0C,EAAUI,MAAMC,QAAU,OAE1B1C,SAAS2C,KAAKC,YAAYP,GAG5B5C,OAAOwB,OAAO4B,cAAc,IAAIC,MAAM","sourcesContent":["import {Component, Inject, OnInit} from '@angular/core';\nimport {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';\nimport {NgForm} from '@angular/forms';\n\nexport interface DialogConfirmacaoData {\n titulo: string;\n mensagem: string;\n okLabel: string;\n cancelLabel?: string;\n}\n\n@Component({\n selector: 'mcl-dialog-confirmacao',\n templateUrl: './dialog-confirmacao.component.html',\n styleUrls: ['./dialog-confirmacao.component.scss']\n})\nexport class DialogConfirmacaoComponent implements OnInit {\n\n constructor(\n @Inject(MAT_DIALOG_DATA) private data: DialogConfirmacaoData,\n private dialogRef: MatDialogRef<any>,\n ) {\n }\n\n get titulo() {\n return this.data.titulo;\n }\n\n get mensagem() {\n return this.data.mensagem;\n }\n\n get okLabel() {\n return this.data.okLabel;\n }\n\n get cancelLabel() {\n return this.data.cancelLabel;\n }\n\n ngOnInit(): void {\n }\n\n confirma(form: NgForm) {\n if (!form.valid) {\n return;\n }\n\n this.dialogRef.close(true);\n }\n}\n","import {AfterViewInit, Component, ElementRef, Inject, ViewChild} from '@angular/core';\nimport {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';\nimport {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';\n\nexport interface DialogIframData {\n url: string;\n titulo: string;\n}\n\n@Component({\n selector: 'mcl-dialog-iframe',\n templateUrl: './dialog-iframe.component.html',\n styleUrls: ['./dialog-iframe.component.scss']\n})\nexport class DialogIframeComponent implements AfterViewInit {\n\n titulo: string;\n url: SafeResourceUrl;\n\n @ViewChild('iframe') iframe: ElementRef;\n\n constructor(\n @Inject(MAT_DIALOG_DATA) dados: DialogIframData,\n private dialogRef: MatDialogRef<any>,\n sanitizer: DomSanitizer,\n ) {\n this.titulo = dados.titulo;\n this.url = sanitizer.bypassSecurityTrustResourceUrl(dados.url);\n }\n\n ngAfterViewInit() {\n registerDialogOnIframe(this.iframe.nativeElement, () => this.close());\n }\n\n private returnValue() {\n const fraContent = this.iframe.nativeElement.contentDocument ||\n this.iframe.nativeElement.contentWindow?.document;\n\n if (fraContent) {\n const divRetornoValue = fraContent.getElementById('returnValue');\n\n if (divRetornoValue) {\n const returnValue = divRetornoValue.innerText;\n\n if (returnValue) {\n return JSON.parse(returnValue);\n }\n }\n }\n\n return undefined;\n }\n\n close() {\n this.dialogRef.close(this.returnValue());\n }\n}\n\nfunction registerDialogOnIframe(iframe, callback) {\n window.addEventListener('dialogIframeClosed', () => callback());\n}\n\nexport function closeDialogIframe(returnValue?: any) {\n if (returnValue) {\n const returnDiv = document.createElement('div');\n\n returnDiv.id = 'returnValue';\n returnDiv.innerText = JSON.stringify(returnValue);\n returnDiv.style.display = 'none';\n\n document.body.appendChild(returnDiv);\n }\n\n window.parent.dispatchEvent(new Event('dialogIframeClosed'));\n}\n","import {Injectable} from '@angular/core';\nimport {Observable} from 'rxjs';\nimport {MatDialog} from '@angular/material/dialog';\nimport {DialogConfirmacaoComponent, DialogConfirmacaoData} from './dialog-confirmacao/dialog-confirmacao.component';\nimport {map} from 'rxjs/operators';\nimport {DialogIframeComponent} from './dialog-iframe/dialog-iframe.component';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DialogService {\n\n constructor(\n private dialog: MatDialog\n ) {\n }\n\n confirma(mensagem: string, config: {\n icon?: string,\n titulo?: string,\n okLabel?: string,\n cancelLabel?: string\n } = {}): Observable<boolean> {\n return this.dialog.open<DialogConfirmacaoComponent, DialogConfirmacaoData, boolean>(DialogConfirmacaoComponent, {\n data: {\n titulo: config.titulo || 'mcl.dialog.confirmacao',\n mensagem,\n okLabel: config.okLabel || 'mcl.dialog.sim',\n cancelLabel: config.cancelLabel || 'mcl.dialog.nao'\n }\n }).afterClosed().pipe(map(result => !!result));\n }\n\n informa(mensagem: string, config: {\n icon?: string,\n titulo?: string,\n okLabel?: string\n } = {}): Observable<boolean> {\n return this.dialog.open<DialogConfirmacaoComponent, DialogConfirmacaoData, boolean>(DialogConfirmacaoComponent, {\n data: {\n titulo: config.titulo || 'mcl.dialog.informacao',\n mensagem,\n okLabel: config.okLabel || 'mcl.dialog.ok',\n }\n }).afterClosed().pipe(map(result => !!result));\n }\n\n iframe(url: string, titulo: string): Observable<any> {\n if (!!window.parent && window.parent !== window) {\n window.location.href = url;\n } else {\n return this.dialog.open(DialogIframeComponent, {\n data: {\n titulo,\n url,\n },\n panelClass: 'dialog-frame',\n }).afterClosed();\n }\n }\n}\n","import {ModuleWithProviders, NgModule} from '@angular/core';\nimport {DialogConfirmacaoComponent} from './dialog-confirmacao/dialog-confirmacao.component';\nimport {DialogIframeComponent} from './dialog-iframe/dialog-iframe.component';\nimport {CommonModule} from '@angular/common';\nimport {TranslateModule} from '@ngx-translate/core';\nimport {MatButtonModule} from '@angular/material/button';\nimport {FormsModule} from '@angular/forms';\nimport {MatIconModule} from '@angular/material/icon';\nimport {MatDialogModule} from '@angular/material/dialog';\nimport {DialogService} from './dialog.service';\n\n\n@NgModule({\n declarations: [\n DialogConfirmacaoComponent,\n DialogIframeComponent,\n ],\n imports: [\n CommonModule,\n TranslateModule,\n MatButtonModule,\n FormsModule,\n MatIconModule,\n MatDialogModule,\n ]\n})\nexport class DialogModule {\n\n static forRoot(): ModuleWithProviders<DialogModule> {\n return {\n ngModule: DialogModule,\n providers: [\n DialogService\n ]\n };\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../../projects/main-class/componentes/dialog/src/dialog-confirmacao/dialog-confirmacao.component.ts","../../../../projects/main-class/componentes/dialog/src/dialog-iframe/dialog-iframe.component.ts","../../../../projects/main-class/componentes/dialog/src/dialog.service.ts","../../../../projects/main-class/componentes/dialog/src/dialog.module.ts"],"names":["DialogConfirmacaoComponent","data","dialogRef","this","Object","defineProperty","prototype","titulo","mensagem","okLabel","cancelLabel","ngOnInit","confirma","form","valid","close","Component","args","selector","template","Inject","MAT_DIALOG_DATA","MatDialogRef","DialogIframeComponent","dados","sanitizer","url","bypassSecurityTrustResourceUrl","ngAfterViewInit","callback","_this","iframe","nativeElement","window","addEventListener","returnValue","fraContent","contentDocument","_a","contentWindow","document","divRetornoValue","getElementById","innerText","JSON","parse","DomSanitizer","ViewChild","DialogService","dialog","config","open","afterClosed","pipe","map","result","informa","parent","panelClass","location","href","Injectable","providedIn","MatDialog","DialogModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","TranslateModule","MatButtonModule","FormsModule","MatIconModule","MatDialogModule","returnDiv","createElement","id","stringify","style","display","body","appendChild","dispatchEvent","Event"],"mappings":"ohCAkBE,SAAAA,EACmCC,EACzBC,GADyBC,KAAAF,KAAAA,EACzBE,KAAAD,UAAAA,SAIVE,OAAAC,eAAIL,EAAAM,UAAA,SAAM,KAAV,WACE,OAAOH,KAAKF,KAAKM,wCAGnBH,OAAAC,eAAIL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C,GAAIA,EAAa,CACf,IAAM0C,EAAYrC,SAASsC,cAAc,OAEzCD,EAAUE,GAAK,cACfF,EAAUlC,UAAYC,KAAKoC,UAAU7C,GACrC0C,EAAUI,MAAMC,QAAU,OAE1B1C,SAAS2C,KAAKC,YAAYP,GAG5B5C,OAAOwB,OAAO4B,cAAc,IAAIC,MAAM","sourcesContent":["import {Component, Inject, OnInit} from '@angular/core';\nimport {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';\nimport {NgForm} from '@angular/forms';\n\nexport interface DialogConfirmacaoData {\n titulo: string;\n mensagem: string;\n okLabel: string;\n cancelLabel?: string;\n}\n\n@Component({\n selector: 'mcl-dialog-confirmacao',\n templateUrl: './dialog-confirmacao.component.html',\n styleUrls: ['./dialog-confirmacao.component.scss']\n})\nexport class DialogConfirmacaoComponent implements OnInit {\n\n constructor(\n @Inject(MAT_DIALOG_DATA) private data: DialogConfirmacaoData,\n private dialogRef: MatDialogRef<any>,\n ) {\n }\n\n get titulo() {\n return this.data.titulo;\n }\n\n get mensagem() {\n return this.data.mensagem;\n }\n\n get okLabel() {\n return this.data.okLabel;\n }\n\n get cancelLabel() {\n return this.data.cancelLabel;\n }\n\n ngOnInit(): void {\n }\n\n confirma(form: NgForm) {\n if (!form.valid) {\n return;\n }\n\n this.dialogRef.close(true);\n }\n}\n","import {AfterViewInit, Component, ElementRef, Inject, ViewChild} from '@angular/core';\nimport {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';\nimport {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';\n\nexport interface DialogIframData {\n url: string;\n titulo: string;\n}\n\n@Component({\n selector: 'mcl-dialog-iframe',\n templateUrl: './dialog-iframe.component.html',\n styleUrls: ['./dialog-iframe.component.scss']\n})\nexport class DialogIframeComponent implements AfterViewInit {\n\n titulo: string;\n url: SafeResourceUrl;\n\n @ViewChild('iframe') iframe: ElementRef;\n\n constructor(\n @Inject(MAT_DIALOG_DATA) dados: DialogIframData,\n private dialogRef: MatDialogRef<any>,\n sanitizer: DomSanitizer,\n ) {\n this.titulo = dados.titulo;\n this.url = sanitizer.bypassSecurityTrustResourceUrl(dados.url);\n }\n\n ngAfterViewInit() {\n registerDialogOnIframe(this.iframe.nativeElement, () => this.close());\n }\n\n private returnValue() {\n const fraContent = this.iframe.nativeElement.contentDocument ||\n this.iframe.nativeElement.contentWindow?.document;\n\n if (fraContent) {\n const divRetornoValue = fraContent.getElementById('returnValue');\n\n if (divRetornoValue) {\n const returnValue = divRetornoValue.innerText;\n\n if (returnValue) {\n return JSON.parse(returnValue);\n }\n }\n }\n\n return undefined;\n }\n\n close() {\n this.dialogRef.close(this.returnValue());\n }\n}\n\nfunction registerDialogOnIframe(iframe, callback) {\n window.addEventListener('dialogIframeClosed', () => callback());\n}\n\nexport function closeDialogIframe(returnValue?: any) {\n if (returnValue) {\n const returnDiv = document.createElement('div');\n\n returnDiv.id = 'returnValue';\n returnDiv.innerText = JSON.stringify(returnValue);\n returnDiv.style.display = 'none';\n\n document.body.appendChild(returnDiv);\n }\n\n window.parent.dispatchEvent(new Event('dialogIframeClosed'));\n}\n","import {Injectable} from '@angular/core';\nimport {Observable} from 'rxjs';\nimport {MatDialog} from '@angular/material/dialog';\nimport {DialogConfirmacaoComponent, DialogConfirmacaoData} from './dialog-confirmacao/dialog-confirmacao.component';\nimport {map} from 'rxjs/operators';\nimport {DialogIframeComponent} from './dialog-iframe/dialog-iframe.component';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DialogService {\n\n constructor(\n private dialog: MatDialog\n ) {\n }\n\n confirma(mensagem: string, config: {\n icon?: string,\n titulo?: string,\n okLabel?: string,\n cancelLabel?: string\n } = {}): Observable<boolean> {\n return this.dialog.open<DialogConfirmacaoComponent, DialogConfirmacaoData, boolean>(DialogConfirmacaoComponent, {\n data: {\n titulo: config.titulo || 'mcl.dialog.confirmacao',\n mensagem,\n okLabel: config.okLabel || 'mcl.dialog.sim',\n cancelLabel: config.cancelLabel || 'mcl.dialog.nao'\n }\n }).afterClosed().pipe(map(result => !!result));\n }\n\n informa(mensagem: string, config: {\n icon?: string,\n titulo?: string,\n okLabel?: string\n } = {}): Observable<boolean> {\n return this.dialog.open<DialogConfirmacaoComponent, DialogConfirmacaoData, boolean>(DialogConfirmacaoComponent, {\n data: {\n titulo: config.titulo || 'mcl.dialog.informacao',\n mensagem,\n okLabel: config.okLabel || 'mcl.dialog.ok',\n }\n }).afterClosed().pipe(map(result => !!result));\n }\n\n iframe(url: string, titulo: string): Observable<any> {\n if (!!window.parent && window.parent !== window) {\n window.location.href = url;\n } else {\n return this.dialog.open(DialogIframeComponent, {\n data: {\n titulo,\n url,\n },\n panelClass: 'dialog-frame',\n }).afterClosed();\n }\n }\n}\n","import {ModuleWithProviders, NgModule} from '@angular/core';\nimport {DialogConfirmacaoComponent} from './dialog-confirmacao/dialog-confirmacao.component';\nimport {DialogIframeComponent} from './dialog-iframe/dialog-iframe.component';\nimport {CommonModule} from '@angular/common';\nimport {TranslateModule} from '@ngx-translate/core';\nimport {MatButtonModule} from '@angular/material/button';\nimport {FormsModule} from '@angular/forms';\nimport {MatIconModule} from '@angular/material/icon';\nimport {MatDialogModule} from '@angular/material/dialog';\nimport {DialogService} from './dialog.service';\n\n\n@NgModule({\n declarations: [\n DialogConfirmacaoComponent,\n DialogIframeComponent,\n ],\n imports: [\n CommonModule,\n TranslateModule,\n MatButtonModule,\n FormsModule,\n MatIconModule,\n MatDialogModule,\n ]\n})\nexport class DialogModule {\n\n static forRoot(): ModuleWithProviders<DialogModule> {\n return {\n ngModule: DialogModule,\n providers: [\n DialogService\n ]\n };\n }\n}\n"]}
@@ -2485,6 +2485,7 @@
2485
2485
  exports.AllOptionCheckboxComponent = AllOptionCheckboxComponent;
2486
2486
  exports.InputDatetimeComponent = InputDatetimeComponent;
2487
2487
  exports.InputDatetimeModule = InputDatetimeModule;
2488
+ exports.InputDatetimeValidatorDirective = InputDatetimeValidatorDirective;
2488
2489
  exports.InputFileUploadComponent = InputFileUploadComponent;
2489
2490
  exports.InputFileUploadValidatorDirective = InputFileUploadValidatorDirective;
2490
2491
  exports.InputFileuploadModule = InputFileuploadModule;
@@ -2505,8 +2506,7 @@
2505
2506
  exports.SelectRadioComponent = SelectRadioComponent;
2506
2507
  exports.SelectRadioModule = SelectRadioModule;
2507
2508
  exports.ɵ0 = ɵ0;
2508
- exports.ɵa = InputDatetimeValidatorDirective;
2509
- exports.ɵb = OptionCheckboxService;
2509
+ exports.ɵa = OptionCheckboxService;
2510
2510
 
2511
2511
  Object.defineProperty(exports, '__esModule', { value: true });
2512
2512