keevo-components 1.5.161 → 1.5.162
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.
- package/esm2020/lib/api/helpers/keevo-validators.mjs +64 -0
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/keevo-components.mjs +65 -2
- package/fesm2015/keevo-components.mjs.map +1 -1
- package/fesm2020/keevo-components.mjs +65 -2
- package/fesm2020/keevo-components.mjs.map +1 -1
- package/lib/api/helpers/keevo-validators.d.ts +10 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -14,7 +14,7 @@ import { MenuModule } from 'primeng/menu';
|
|
|
14
14
|
import * as i2 from 'primeng/ripple';
|
|
15
15
|
import { RippleModule } from 'primeng/ripple';
|
|
16
16
|
import * as i2$1 from '@angular/forms';
|
|
17
|
-
import { FormGroup, NgControl, FormControlName, FormGroupDirective, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule
|
|
17
|
+
import { FormGroup, NgControl, FormControlName, FormGroupDirective, NG_VALUE_ACCESSOR, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
18
18
|
import * as i1$3 from 'primeng/dynamicdialog';
|
|
19
19
|
import { DynamicDialogModule, DialogService, DynamicDialogRef, DynamicDialogConfig } from 'primeng/dynamicdialog';
|
|
20
20
|
import * as i1$2 from 'primeng/api';
|
|
@@ -1415,6 +1415,69 @@ class TranslatePrimeng {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
1417
|
|
|
1418
|
+
class KeevoValidators {
|
|
1419
|
+
static required(erroMessage) {
|
|
1420
|
+
return (control) => {
|
|
1421
|
+
if (Validators.required(control))
|
|
1422
|
+
return { required: true, erroMessage: `${erroMessage ? erroMessage : 'Campo obrigatório'}` };
|
|
1423
|
+
return null;
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
static dateGreaterThan(startControlName, erroMessage) {
|
|
1427
|
+
return (endControl) => {
|
|
1428
|
+
const parent = endControl.parent;
|
|
1429
|
+
if (!parent)
|
|
1430
|
+
return null;
|
|
1431
|
+
const startControl = parent.get(startControlName);
|
|
1432
|
+
const startDate = startControl.value;
|
|
1433
|
+
const endDate = endControl.value;
|
|
1434
|
+
if (!startDate || !endDate) {
|
|
1435
|
+
return null;
|
|
1436
|
+
}
|
|
1437
|
+
if (startDate > endDate) {
|
|
1438
|
+
return { greaterThan: true, erroMessage: erroMessage };
|
|
1439
|
+
}
|
|
1440
|
+
return null;
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1443
|
+
static min(min, erroMessage) {
|
|
1444
|
+
return (control) => {
|
|
1445
|
+
if (Validators.min(min)(control))
|
|
1446
|
+
return { min: true, erroMessage: `${erroMessage ? erroMessage : 'Informe um valor maior ou igual à '}${min}` };
|
|
1447
|
+
return null;
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
static max(min, erroMessage) {
|
|
1451
|
+
return (control) => {
|
|
1452
|
+
if (Validators.max(min)(control))
|
|
1453
|
+
return { min: true, erroMessage: `${erroMessage ? erroMessage : 'Informe um valor menor ou igual à '}${min}` };
|
|
1454
|
+
return null;
|
|
1455
|
+
};
|
|
1456
|
+
}
|
|
1457
|
+
static email(erroMessage) {
|
|
1458
|
+
return (control) => {
|
|
1459
|
+
if (Validators.email(control)) {
|
|
1460
|
+
return { email: true, erroMessage: `${erroMessage ? erroMessage : 'Endereço de e-mail inválido!'}` };
|
|
1461
|
+
}
|
|
1462
|
+
return null;
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
static maxLengthArray(max) {
|
|
1466
|
+
return (c) => {
|
|
1467
|
+
if (c.value.length < max)
|
|
1468
|
+
return null;
|
|
1469
|
+
return { maxLengthArray: true, erroMessage: 'Tamanho máximo excedido!' };
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
static maxLength(max, erroMessage) {
|
|
1473
|
+
return (control) => {
|
|
1474
|
+
if (Validators.maxLength(max)(control))
|
|
1475
|
+
return { maxLength: true, erroMessage: `${erroMessage ? erroMessage : 'Limite máximo de ${max} caracteres atingido!'}` };
|
|
1476
|
+
return null;
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1418
1481
|
class CodigoFipePipe {
|
|
1419
1482
|
transform(value) {
|
|
1420
1483
|
if (value) {
|
|
@@ -4267,5 +4330,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
4267
4330
|
* Generated bundle index. Do not edit.
|
|
4268
4331
|
*/
|
|
4269
4332
|
|
|
4270
|
-
export { BaseApiService, BaseChartComponent, BaseComponent, BaseComponentButton, BaseComponentCrud, BaseComponentCrudForm, BaseComponentCrudList, BaseComponentDropDown, BaseComponentInput, BaseComponentMultiSelect, ButtonPersonalizeComponent, ButtonPopupComponent, ButtonSecondaryComponent, ButtonSuccessComponent, ChartComponent, CheckComponent, CodigoFipePipe, ComponentProviders, ComponentService, CpfCnpjPipe, DropdownComponent, EditorComponent, ErrorComponent, FormService, InputCalendarComponent, InputMaskComponent, InputNumberComponent, InputPasswordComponent, InputTextCheckboxComponent, InputTextComponent, InputTextareaComponent, InputTimeComponent, KVTreeTableModule, KeevoComponentsModule, KvButtonsModule, KvChartModule, KvInputsModule, KvLoginModule, KvMenuModule, KvPageFormModule, KvPickListModule, KvTableModule, KvWorkspaceModule, KvtreeViewModule, LoginComponent, MenuComponent, MultiSelectComponent, NotificationService, ObjectService, OrgchartComponent, OrgchartModule, PageFormComponent, PeriodosChart, PickListComponent, PipesModule, PrimeNgModule, RadioGroupComponent, SwitchComponent, TableComponent, TablePaginate, TelefonePipe, TranslatePrimeng, TreeTableComponent, TreeViewComponent, WorkspaceComponent, kvErrorModule };
|
|
4333
|
+
export { BaseApiService, BaseChartComponent, BaseComponent, BaseComponentButton, BaseComponentCrud, BaseComponentCrudForm, BaseComponentCrudList, BaseComponentDropDown, BaseComponentInput, BaseComponentMultiSelect, ButtonPersonalizeComponent, ButtonPopupComponent, ButtonSecondaryComponent, ButtonSuccessComponent, ChartComponent, CheckComponent, CodigoFipePipe, ComponentProviders, ComponentService, CpfCnpjPipe, DropdownComponent, EditorComponent, ErrorComponent, FormService, InputCalendarComponent, InputMaskComponent, InputNumberComponent, InputPasswordComponent, InputTextCheckboxComponent, InputTextComponent, InputTextareaComponent, InputTimeComponent, KVTreeTableModule, KeevoComponentsModule, KeevoValidators, KvButtonsModule, KvChartModule, KvInputsModule, KvLoginModule, KvMenuModule, KvPageFormModule, KvPickListModule, KvTableModule, KvWorkspaceModule, KvtreeViewModule, LoginComponent, MenuComponent, MultiSelectComponent, NotificationService, ObjectService, OrgchartComponent, OrgchartModule, PageFormComponent, PeriodosChart, PickListComponent, PipesModule, PrimeNgModule, RadioGroupComponent, SwitchComponent, TableComponent, TablePaginate, TelefonePipe, TranslatePrimeng, TreeTableComponent, TreeViewComponent, WorkspaceComponent, kvErrorModule };
|
|
4271
4334
|
//# sourceMappingURL=keevo-components.mjs.map
|