@koalarx/ui
Version:
Koala UI is a modern and accessible component library designed to speed up interface development in Angular projects. With simple integration and clear documentation, you can easily build robust and visually appealing applications.
1 lines • 2.79 kB
Source Map (JSON)
{"version":3,"file":"koalarx-ui-shared-components-input-field-input-cpf.mjs","sources":["../../projects/koala-ui/shared/components/input-field/input-cpf/cpf.validator.ts","../../projects/koala-ui/shared/components/input-field/input-cpf/input-cpf.ts","../../projects/koala-ui/shared/components/input-field/input-cpf/input-cpf.html","../../projects/koala-ui/shared/components/input-field/input-cpf/koalarx-ui-shared-components-input-field-input-cpf.ts"],"sourcesContent":["import { AbstractControl } from '@angular/forms';\r\nimport { validateCpf } from '@koalarx/utils/KlString';\r\n\r\nexport function CPFValidator(control: AbstractControl) {\r\n if (control.value && !validateCpf(control.value)) {\r\n return { cpfInvalid: true };\r\n }\r\n\r\n return null;\r\n}\r\n","import { Component, effect, inject } from '@angular/core';\nimport { AppConfig } from '@koalarx/ui/core/config';\nimport { InputFieldBase } from '@koalarx/ui/shared/components/input-field';\nimport { InputText } from '@koalarx/ui/shared/components/input-field/input-text';\nimport { CPFValidator } from './cpf.validator';\n\n@Component({\n selector: 'kl-input-cpf',\n templateUrl: './input-cpf.html',\n imports: [InputText],\n})\nexport class InputCpf extends InputFieldBase {\n readonly translations = inject(AppConfig).translation.form;\n\n constructor() {\n super();\n\n effect(() => {\n const control = this.control();\n\n control.addValidators(CPFValidator);\n });\n }\n}\n","<kl-input-text\n [control]=\"control()\"\n [label]=\"label()\"\n [placeholder]=\"placeholder()\"\n mask=\"000.000.000-00\">\n\n <ng-container errors>\n @if (control().errors?.['cpfInvalid']) {\n <div class=\"error-message\">{{ translations.invalidCPF }}</div>\n }\n </ng-container>\n</kl-input-text>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAGM,SAAU,YAAY,CAAC,OAAwB,EAAA;AACnD,IAAA,IAAI,OAAO,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AAChD,QAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE;;AAG7B,IAAA,OAAO,IAAI;AACb;;ACEM,MAAO,QAAS,SAAQ,cAAc,CAAA;IACjC,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,IAAI;AAE1D,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;QAEP,MAAM,CAAC,MAAK;AACV,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE;AAE9B,YAAA,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC;AACrC,SAAC,CAAC;;uGAVO,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAR,QAAQ,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECXrB,gUAYA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDHY,SAAS,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,CAAA,MAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAER,QAAQ,EAAA,UAAA,EAAA,CAAA;kBALpB,SAAS;+BACE,cAAc,EAAA,OAAA,EAEf,CAAC,SAAS,CAAC,EAAA,QAAA,EAAA,gUAAA,EAAA;;;AETtB;;AAEG;;;;"}