keevo-components 0.0.9 → 0.1.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 (123) hide show
  1. package/esm2020/keevo-components.mjs +5 -0
  2. package/esm2020/lib/api/base-components/base-component-button.mjs +33 -0
  3. package/esm2020/lib/api/base-components/base-component-dropdown.mjs +115 -0
  4. package/esm2020/lib/api/base-components/base-component-input.mjs +77 -0
  5. package/esm2020/lib/api/base-components/base-component.mjs +49 -0
  6. package/esm2020/lib/api/components/error/error.component.mjs +26 -0
  7. package/esm2020/lib/api/components/error/kverror.module.mjs +35 -0
  8. package/esm2020/lib/api/helpers/component-providers.mjs +16 -0
  9. package/esm2020/lib/api/helpers/translate-primeng.mjs +23 -0
  10. package/esm2020/lib/api/modules/primeng.module.mjs +187 -0
  11. package/esm2020/lib/api/services/component.service.mjs +27 -0
  12. package/esm2020/lib/api/services/object.service.mjs +26 -0
  13. package/esm2020/lib/buttons/button-secondary/button-secondary.component.mjs +17 -0
  14. package/esm2020/lib/buttons/button-success/button-success.component.mjs +17 -0
  15. package/esm2020/lib/buttons/kvbutton.module.mjs +29 -0
  16. package/esm2020/lib/inputs/check/check.component.mjs +26 -0
  17. package/esm2020/lib/inputs/dropdown/dropdown.component.mjs +26 -0
  18. package/esm2020/lib/inputs/input-calendar/input-calendar.component.mjs +62 -0
  19. package/esm2020/lib/inputs/input-mask/input-mask.component.mjs +22 -0
  20. package/esm2020/lib/inputs/input-number/input-number.component.mjs +56 -0
  21. package/esm2020/lib/inputs/input-password/input-password.component.mjs +32 -0
  22. package/esm2020/lib/inputs/input-text/input-text.component.mjs +20 -0
  23. package/esm2020/lib/inputs/input-textarea/input-textarea.component.mjs +42 -0
  24. package/esm2020/lib/inputs/input-time/input-time.component.mjs +23 -0
  25. package/esm2020/lib/inputs/kvinputs.module.mjs +89 -0
  26. package/esm2020/lib/inputs/multi-select/multi-select.component.mjs +50 -0
  27. package/esm2020/lib/inputs/switch/switch.component.mjs +26 -0
  28. package/esm2020/lib/keevo-components.module.mjs +28 -0
  29. package/esm2020/public-api.mjs +31 -0
  30. package/fesm2015/keevo-components.mjs +1050 -0
  31. package/fesm2015/keevo-components.mjs.map +1 -0
  32. package/fesm2020/keevo-components.mjs +1046 -0
  33. package/fesm2020/keevo-components.mjs.map +1 -0
  34. package/index.d.ts +5 -0
  35. package/lib/api/base-components/base-component-button.d.ts +13 -0
  36. package/lib/api/base-components/base-component-dropdown.d.ts +31 -0
  37. package/lib/api/base-components/base-component-input.d.ts +26 -0
  38. package/lib/api/base-components/base-component.d.ts +21 -0
  39. package/lib/api/components/error/error.component.d.ts +12 -0
  40. package/lib/api/components/error/kverror.module.d.ts +10 -0
  41. package/lib/api/helpers/component-providers.d.ts +2 -0
  42. package/lib/api/helpers/translate-primeng.d.ts +4 -0
  43. package/lib/api/modules/primeng.module.d.ts +45 -0
  44. package/lib/api/services/component.service.d.ts +11 -0
  45. package/lib/api/services/object.service.d.ts +8 -0
  46. package/lib/buttons/button-secondary/button-secondary.component.d.ts +7 -0
  47. package/lib/buttons/button-success/button-success.component.d.ts +7 -0
  48. package/lib/buttons/kvbutton.module.d.ts +9 -0
  49. package/lib/inputs/check/check.component.d.ts +11 -0
  50. package/lib/inputs/dropdown/dropdown.component.d.ts +9 -0
  51. package/lib/inputs/input-calendar/input-calendar.component.d.ts +21 -0
  52. package/lib/inputs/input-mask/input-mask.component.d.ts +10 -0
  53. package/lib/inputs/input-number/input-number.component.d.ts +18 -0
  54. package/lib/inputs/input-password/input-password.component.d.ts +12 -0
  55. package/lib/inputs/input-text/input-text.component.d.ts +9 -0
  56. package/lib/inputs/input-textarea/input-textarea.component.d.ts +16 -0
  57. package/lib/inputs/input-time/input-time.component.d.ts +10 -0
  58. package/lib/inputs/kvinputs.module.d.ts +21 -0
  59. package/lib/inputs/multi-select/multi-select.component.d.ts +20 -0
  60. package/lib/inputs/switch/switch.component.d.ts +11 -0
  61. package/lib/keevo-components.module.d.ts +8 -0
  62. package/package.json +22 -3
  63. package/{src/public-api.ts → public-api.d.ts} +27 -34
  64. package/ng-package.json +0 -7
  65. package/src/index.ts +0 -1
  66. package/src/lib/api/base-components/base-component-button.ts +0 -25
  67. package/src/lib/api/base-components/base-component-dropdown.ts +0 -126
  68. package/src/lib/api/base-components/base-component-input.ts +0 -91
  69. package/src/lib/api/base-components/base-component.ts +0 -46
  70. package/src/lib/api/components/error/error.component.html +0 -3
  71. package/src/lib/api/components/error/error.component.scss +0 -0
  72. package/src/lib/api/components/error/error.component.ts +0 -22
  73. package/src/lib/api/components/error/kverror.module.ts +0 -23
  74. package/src/lib/api/helpers/component-providers.ts +0 -16
  75. package/src/lib/api/helpers/translate-primeng.ts +0 -25
  76. package/src/lib/api/modules/primeng.module.ts +0 -95
  77. package/src/lib/api/services/component.service.ts +0 -22
  78. package/src/lib/api/services/object.service.ts +0 -20
  79. package/src/lib/buttons/button-secondary/button-secondary.component.html +0 -9
  80. package/src/lib/buttons/button-secondary/button-secondary.component.scss +0 -13
  81. package/src/lib/buttons/button-secondary/button-secondary.component.ts +0 -13
  82. package/src/lib/buttons/button-success/button-success.component.html +0 -9
  83. package/src/lib/buttons/button-success/button-success.component.scss +0 -12
  84. package/src/lib/buttons/button-success/button-success.component.ts +0 -13
  85. package/src/lib/buttons/kvbutton.module.ts +0 -19
  86. package/src/lib/inputs/check/check.component.html +0 -11
  87. package/src/lib/inputs/check/check.component.scss +0 -0
  88. package/src/lib/inputs/check/check.component.ts +0 -24
  89. package/src/lib/inputs/dropdown/dropdown.component.html +0 -41
  90. package/src/lib/inputs/dropdown/dropdown.component.scss +0 -0
  91. package/src/lib/inputs/dropdown/dropdown.component.ts +0 -19
  92. package/src/lib/inputs/input-calendar/input-calendar.component.html +0 -22
  93. package/src/lib/inputs/input-calendar/input-calendar.component.scss +0 -0
  94. package/src/lib/inputs/input-calendar/input-calendar.component.ts +0 -54
  95. package/src/lib/inputs/input-mask/input-mask.component.html +0 -15
  96. package/src/lib/inputs/input-mask/input-mask.component.scss +0 -0
  97. package/src/lib/inputs/input-mask/input-mask.component.ts +0 -20
  98. package/src/lib/inputs/input-number/input-number.component.html +0 -15
  99. package/src/lib/inputs/input-number/input-number.component.scss +0 -0
  100. package/src/lib/inputs/input-number/input-number.component.ts +0 -51
  101. package/src/lib/inputs/input-password/input-password.component.html +0 -18
  102. package/src/lib/inputs/input-password/input-password.component.scss +0 -0
  103. package/src/lib/inputs/input-password/input-password.component.ts +0 -23
  104. package/src/lib/inputs/input-text/input-text.component.html +0 -14
  105. package/src/lib/inputs/input-text/input-text.component.scss +0 -18
  106. package/src/lib/inputs/input-text/input-text.component.ts +0 -17
  107. package/src/lib/inputs/input-textarea/input-textarea.component.html +0 -17
  108. package/src/lib/inputs/input-textarea/input-textarea.component.scss +0 -0
  109. package/src/lib/inputs/input-textarea/input-textarea.component.ts +0 -33
  110. package/src/lib/inputs/input-time/input-time.component.html +0 -18
  111. package/src/lib/inputs/input-time/input-time.component.scss +0 -0
  112. package/src/lib/inputs/input-time/input-time.component.ts +0 -20
  113. package/src/lib/inputs/kvinputs.module.ts +0 -53
  114. package/src/lib/inputs/multi-select/multi-select.component.html +0 -21
  115. package/src/lib/inputs/multi-select/multi-select.component.scss +0 -0
  116. package/src/lib/inputs/multi-select/multi-select.component.ts +0 -44
  117. package/src/lib/inputs/switch/switch.component.html +0 -11
  118. package/src/lib/inputs/switch/switch.component.scss +0 -3
  119. package/src/lib/inputs/switch/switch.component.ts +0 -24
  120. package/src/lib/keevo-components.module.ts +0 -17
  121. package/tsconfig.lib.json +0 -14
  122. package/tsconfig.lib.prod.json +0 -10
  123. package/tsconfig.spec.json +0 -14
@@ -0,0 +1,21 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./check/check.component";
3
+ import * as i2 from "./dropdown/dropdown.component";
4
+ import * as i3 from "./input-calendar/input-calendar.component";
5
+ import * as i4 from "./input-mask/input-mask.component";
6
+ import * as i5 from "./input-number/input-number.component";
7
+ import * as i6 from "./input-password/input-password.component";
8
+ import * as i7 from "./input-text/input-text.component";
9
+ import * as i8 from "./input-textarea/input-textarea.component";
10
+ import * as i9 from "./input-time/input-time.component";
11
+ import * as i10 from "./multi-select/multi-select.component";
12
+ import * as i11 from "./switch/switch.component";
13
+ import * as i12 from "@angular/common";
14
+ import * as i13 from "@angular/forms";
15
+ import * as i14 from "../api/components/error/kverror.module";
16
+ import * as i15 from "../api/modules/primeng.module";
17
+ export declare class KvInputsModule {
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<KvInputsModule, never>;
19
+ static ɵmod: i0.ɵɵNgModuleDeclaration<KvInputsModule, [typeof i1.CheckComponent, typeof i2.DropdownComponent, typeof i3.InputCalendarComponent, typeof i4.InputMaskComponent, typeof i5.InputNumberComponent, typeof i6.InputPasswordComponent, typeof i7.InputTextComponent, typeof i8.InputTextareaComponent, typeof i9.InputTimeComponent, typeof i10.MultiSelectComponent, typeof i11.SwitchComponent], [typeof i12.CommonModule, typeof i13.FormsModule, typeof i14.kvErrorModule, typeof i15.PrimeNgModule, typeof i13.ReactiveFormsModule], [typeof i1.CheckComponent, typeof i2.DropdownComponent, typeof i3.InputCalendarComponent, typeof i4.InputMaskComponent, typeof i5.InputNumberComponent, typeof i6.InputPasswordComponent, typeof i7.InputTextComponent, typeof i8.InputTextareaComponent, typeof i9.InputTimeComponent, typeof i10.MultiSelectComponent, typeof i11.SwitchComponent]>;
20
+ static ɵinj: i0.ɵɵInjectorDeclaration<KvInputsModule>;
21
+ }
@@ -0,0 +1,20 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { BaseComponentInput } from '../../api/base-components/base-component-input';
3
+ import { ComponentService } from '../../api/services/component.service';
4
+ import * as i0 from "@angular/core";
5
+ export declare class MultiSelectComponent extends BaseComponentInput<any> implements OnInit {
6
+ options: any;
7
+ optionLabel: string;
8
+ optionValue: string;
9
+ filter: boolean;
10
+ showClear: boolean;
11
+ onSelectionChange: EventEmitter<any>;
12
+ onPanelHide: EventEmitter<any>;
13
+ constructor(componentService: ComponentService);
14
+ ngOnInit(): void;
15
+ get baseInputClass(): string;
16
+ selectionChange(event: Event): void;
17
+ panelHide(event: Event): void;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<MultiSelectComponent, never>;
19
+ static ɵcmp: i0.ɵɵComponentDeclaration<MultiSelectComponent, "kv-multi-select", never, { "options": "options"; "optionLabel": "optionLabel"; "optionValue": "optionValue"; "filter": "filter"; "showClear": "showClear"; }, { "onSelectionChange": "onSelectionChange"; "onPanelHide": "onPanelHide"; }, never, ["*"], false, never>;
20
+ }
@@ -0,0 +1,11 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { BaseComponentInput } from '../../api/base-components/base-component-input';
3
+ import { ComponentService } from '../../api/services/component.service';
4
+ import * as i0 from "@angular/core";
5
+ export declare class SwitchComponent extends BaseComponentInput<boolean> implements OnInit {
6
+ onSwitchChange: EventEmitter<any>;
7
+ constructor(componentService: ComponentService);
8
+ emitOnSwitchChange(event: any): void;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<SwitchComponent, never>;
10
+ static ɵcmp: i0.ɵɵComponentDeclaration<SwitchComponent, "kv-switch", never, {}, { "onSwitchChange": "onSwitchChange"; }, never, never, false, never>;
11
+ }
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./inputs/kvinputs.module";
3
+ import * as i2 from "./buttons/kvbutton.module";
4
+ export declare class KeevoComponentsModule {
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeevoComponentsModule, never>;
6
+ static ɵmod: i0.ɵɵNgModuleDeclaration<KeevoComponentsModule, never, [typeof i1.KvInputsModule, typeof i2.KvButtonsModule], [typeof i1.KvInputsModule, typeof i2.KvButtonsModule]>;
7
+ static ɵinj: i0.ɵɵInjectorDeclaration<KeevoComponentsModule>;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keevo-components",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^15.2.0",
6
6
  "@angular/core": "^15.2.0"
@@ -16,5 +16,24 @@
16
16
  },
17
17
  "keywords": [
18
18
  "keevo components library"
19
- ]
20
- }
19
+ ],
20
+ "module": "fesm2015/keevo-components.mjs",
21
+ "es2020": "fesm2020/keevo-components.mjs",
22
+ "esm2020": "esm2020/keevo-components.mjs",
23
+ "fesm2020": "fesm2020/keevo-components.mjs",
24
+ "fesm2015": "fesm2015/keevo-components.mjs",
25
+ "typings": "index.d.ts",
26
+ "exports": {
27
+ "./package.json": {
28
+ "default": "./package.json"
29
+ },
30
+ ".": {
31
+ "types": "./index.d.ts",
32
+ "esm2020": "./esm2020/keevo-components.mjs",
33
+ "es2020": "./fesm2020/keevo-components.mjs",
34
+ "es2015": "./fesm2015/keevo-components.mjs",
35
+ "node": "./fesm2015/keevo-components.mjs",
36
+ "default": "./fesm2020/keevo-components.mjs"
37
+ }
38
+ }
39
+ }
@@ -1,34 +1,27 @@
1
- /*
2
- * Public API Surface of keevo-components
3
- */
4
-
5
- export * from './lib/inputs/check/check.component';
6
- export * from './lib/inputs/dropdown/dropdown.component';
7
- export * from './lib/inputs/input-calendar/input-calendar.component';
8
- export * from './lib/inputs/input-mask/input-mask.component';
9
- export * from './lib/inputs/input-number/input-number.component';
10
- export * from './lib/inputs/input-password/input-password.component';
11
- export * from './lib/inputs/input-text/input-text.component';
12
- export * from './lib/inputs/input-textarea/input-textarea.component';
13
- export * from './lib/inputs/input-time/input-time.component';
14
- export * from './lib/inputs/multi-select/multi-select.component';
15
- export * from './lib/inputs/switch/switch.component';
16
- export * from './lib/buttons/button-secondary/button-secondary.component';
17
- export * from './lib/buttons/button-success/button-success.component';
18
- export * from './lib/api/components/error/error.component';
19
- export * from './lib/api/base-components/base-component';
20
- export * from './lib/api/base-components/base-component-button';
21
- export * from './lib/api/base-components/base-component-dropdown';
22
- export * from './lib/api/base-components/base-component-input';
23
-
24
- export * from './lib/keevo-components.module';
25
- export * from './lib/buttons/kvbutton.module';
26
- export * from './lib/inputs/kvinputs.module';
27
- export * from './lib/api/components/error/kverror.module';
28
-
29
- export * from './lib/api/helpers/component-providers';
30
- export * from './lib/api/helpers/translate-primeng';
31
- export * from './lib/api/modules/primeng.module';
32
- export * from './lib/api/services/component.service';
33
- export * from './lib/api/services/object.service';
34
-
1
+ export * from './lib/inputs/check/check.component';
2
+ export * from './lib/inputs/dropdown/dropdown.component';
3
+ export * from './lib/inputs/input-calendar/input-calendar.component';
4
+ export * from './lib/inputs/input-mask/input-mask.component';
5
+ export * from './lib/inputs/input-number/input-number.component';
6
+ export * from './lib/inputs/input-password/input-password.component';
7
+ export * from './lib/inputs/input-text/input-text.component';
8
+ export * from './lib/inputs/input-textarea/input-textarea.component';
9
+ export * from './lib/inputs/input-time/input-time.component';
10
+ export * from './lib/inputs/multi-select/multi-select.component';
11
+ export * from './lib/inputs/switch/switch.component';
12
+ export * from './lib/buttons/button-secondary/button-secondary.component';
13
+ export * from './lib/buttons/button-success/button-success.component';
14
+ export * from './lib/api/components/error/error.component';
15
+ export * from './lib/api/base-components/base-component';
16
+ export * from './lib/api/base-components/base-component-button';
17
+ export * from './lib/api/base-components/base-component-dropdown';
18
+ export * from './lib/api/base-components/base-component-input';
19
+ export * from './lib/keevo-components.module';
20
+ export * from './lib/buttons/kvbutton.module';
21
+ export * from './lib/inputs/kvinputs.module';
22
+ export * from './lib/api/components/error/kverror.module';
23
+ export * from './lib/api/helpers/component-providers';
24
+ export * from './lib/api/helpers/translate-primeng';
25
+ export * from './lib/api/modules/primeng.module';
26
+ export * from './lib/api/services/component.service';
27
+ export * from './lib/api/services/object.service';
package/ng-package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/keevo-components",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- }
7
- }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './public-api';
@@ -1,25 +0,0 @@
1
- import {
2
- Component,
3
- EventEmitter,
4
- Input,
5
- Output
6
- } from '@angular/core';
7
-
8
- @Component({
9
- template: '',
10
- })
11
- export class BaseComponentButton {
12
-
13
- @Input() icon: string = '';
14
- @Input() label: string = '';
15
- @Input() loading: boolean = false;
16
- @Input() disabled: boolean = false;
17
-
18
- @Output() onClick: EventEmitter<any> = new EventEmitter();
19
-
20
- constructor() { }
21
-
22
- click(event: any): void {
23
- this.onClick.emit();
24
- }
25
- }
@@ -1,126 +0,0 @@
1
- import {
2
- Component,
3
- EventEmitter,
4
- Input,
5
- OnInit,
6
- Output,
7
- Type,
8
- } from '@angular/core';
9
-
10
- import { FormControl } from '@angular/forms';
11
- import { of } from 'rxjs';
12
- import { DialogService } from 'primeng/dynamicdialog';
13
-
14
- import { BaseComponentInput } from './base-component-input';
15
-
16
- import { ComponentService } from '../services/component.service';
17
- import { ObjectService } from '../services/object.service';
18
-
19
- @Component({
20
- template: '',
21
- })
22
- export abstract class BaseComponentDropDown
23
- extends BaseComponentInput<any>
24
- implements OnInit
25
- {
26
- @Input() options!: any[];
27
- @Input() filteredOptions!: any[];
28
- @Input() optionLabel!: string;
29
- @Input() optionValue!: string;
30
- @Input() addButton: boolean = false;
31
- @Input() filter: boolean = true;
32
- @Input() showClear: boolean = true;
33
-
34
- @Output() onAddClick: EventEmitter<any> = new EventEmitter();
35
- @Output() onSelectionChange: EventEmitter<any> = new EventEmitter();
36
- @Output() onSelectionValue: EventEmitter<any> = new EventEmitter();
37
- @Output() onClick: EventEmitter<any> = new EventEmitter();
38
-
39
- constructor(
40
- componentService: ComponentService,
41
- private dialogService: DialogService
42
- ) {
43
- super(componentService);
44
- }
45
-
46
- override ngOnInit(): void {
47
- super.ngOnInit();
48
- this.carregarCombo();
49
- this.setPlaceHolder('Selecione um valor');
50
- }
51
-
52
- protected addClick(event: Event) {
53
- this.onAddClick.emit(event);
54
- }
55
-
56
- private carregarCombo(): void {
57
- this.listar().subscribe({
58
- next: (data: any) => {
59
- this.options = data;
60
- this.filteredOptions = data;
61
- },
62
- error: (error: any) => {},
63
- });
64
- }
65
-
66
- public filterOptions(field: string, value: any): void {
67
- if (this.options) {
68
- let lista = ObjectService.filterObject(this.options, field, value);
69
- if (lista?.length > 0) {
70
- of(lista).subscribe((opts: any[]) => {
71
- this.filteredOptions = opts;
72
- });
73
- } else this.filteredOptions = [];
74
- }
75
- }
76
-
77
- protected listar(): any {}
78
-
79
- onInputClick(event: any) {
80
- this.onClick.emit(event);
81
- }
82
-
83
- protected openDialog(
84
- componentType: Type<any>,
85
- width?: string,
86
- height?: string
87
- ) {
88
- const ref = this.dialogService.open(componentType, {
89
- width: width || '70%',
90
- height: height,
91
- closable: false,
92
- maximizable: true,
93
- data: { popup: true },
94
- });
95
-
96
- ref.onClose.subscribe((id: any) => {
97
- if (id) {
98
- this.listar().subscribe((data: any) => {
99
- this.options = data;
100
- this.filteredOptions = data;
101
- if (id) this.formControl?.setValue(id);
102
- });
103
- }
104
- });
105
- }
106
-
107
- protected selectionValue(event: any) {
108
- this.onSelectionValue.emit(event);
109
-
110
- let currentItem = null;
111
-
112
- const controlName = this.getName(this.formControl as FormControl);
113
- if (controlName)
114
- currentItem = ObjectService.findObject(
115
- this.options,
116
- controlName,
117
- event.value
118
- );
119
-
120
- this.onSelectionChange.emit(currentItem);
121
- }
122
-
123
- protected setPlaceHolder(p: string) {
124
- if (!this.placeholder) this.placeholder = p;
125
- }
126
- }
@@ -1,91 +0,0 @@
1
- import {
2
- AfterContentInit,
3
- AfterViewInit,
4
- Component,
5
- ContentChildren,
6
- EventEmitter,
7
- Input,
8
- OnInit,
9
- Output,
10
- QueryList,
11
- ViewChildren
12
- } from "@angular/core";
13
-
14
- import { FormControl } from '@angular/forms';
15
-
16
- import { BaseComponent } from './base-component';
17
-
18
- import { ComponentService } from '../services/component.service';
19
- import { ErrorComponent } from '../components/error/error.component';
20
-
21
- @Component({
22
- template: '',
23
- })
24
- export abstract class BaseComponentInput<T> extends BaseComponent<T> implements OnInit, AfterContentInit, AfterViewInit {
25
-
26
- protected formControl: FormControl | undefined;
27
- protected hasError: boolean | undefined = false;
28
-
29
- @Input() placeholder: string = '';
30
-
31
- @Output() onBlur: EventEmitter<any> = new EventEmitter();
32
-
33
- @ViewChildren(ErrorComponent) viewErrors!: QueryList<ErrorComponent>;
34
- @ContentChildren(ErrorComponent) contentErrors!: QueryList<ErrorComponent>;
35
-
36
- constructor(protected readonly componentService: ComponentService) {
37
- super();
38
- }
39
-
40
- public get baseInputClass(): string {
41
- return `${this.hasError ? 'ng-invalid ng-dirty' : ''} !important`;
42
- }
43
-
44
- erroMessage(): string | undefined {
45
- if (!this.formControl?.errors) return;
46
-
47
- let message: string = '';
48
-
49
- if (this.formControl.errors) {
50
- const objErrors = this.formControl.errors as any;
51
- if (objErrors.erroMessage) message = objErrors.erroMessage;
52
- }
53
-
54
- return message;
55
- }
56
-
57
- getName(control: FormControl): string | null {
58
- return Object.entries(control.parent?.controls ?? []).find(([_, value]) => value === control)?.[0] ?? null;
59
- }
60
-
61
- hasControlError(): boolean {
62
- if (!this.formControl) return false;
63
- return (this.formControl.dirty || this.formControl.touched) && this.formControl.errors !== null;
64
- }
65
-
66
- ngAfterViewInit(): void {
67
- this.viewErrors.forEach(c => {
68
- c.emitError.subscribe(res => {
69
- this.hasError = res;
70
- this.componentService.changeDetectorRef.detectChanges();
71
- });
72
- });
73
- }
74
-
75
- ngAfterContentInit() {
76
- this.contentErrors.forEach(c => {
77
- c.emitError.subscribe(res => {
78
- this.hasError = res;
79
- });
80
- });
81
- }
82
-
83
- ngOnInit(): void {
84
- this.formControl = this.componentService.getFormControl();
85
- }
86
-
87
- onInputBlur(event: Event) {
88
- this.onTouched();
89
- this.onBlur.emit(event);
90
- }
91
- }
@@ -1,46 +0,0 @@
1
- import { Component, Input } from "@angular/core";
2
- import { ControlValueAccessor } from "@angular/forms";
3
- import { Subject } from "rxjs";
4
-
5
- @Component({
6
- template: ''
7
- })
8
- export abstract class BaseComponent<T> implements ControlValueAccessor {
9
-
10
- protected stateChanges: Subject<void> = new Subject();
11
- protected onChange!: (value: T) => void;
12
- protected onTouched!: () => void;
13
- protected _value!: T;
14
-
15
- @Input('required') isRequired: boolean = false;
16
-
17
- public set value(value: T) {
18
- this._value = value;
19
- if (this.onChange) this.onChange(value);
20
- this.stateChanges.next();
21
- }
22
-
23
- public get value(): T {
24
- return this._value;
25
- }
26
-
27
- @Input() componentId!: string;
28
- @Input() label!: string;
29
- @Input() disabled: boolean = false;
30
-
31
- registerOnChange(fn: any): void {
32
- this.onChange = fn;
33
- }
34
-
35
- registerOnTouched(fn: any): void {
36
- this.onTouched = fn;
37
- }
38
-
39
- setDisabledState?(isDisabled: boolean): void {
40
- this.disabled = isDisabled;
41
- }
42
-
43
- writeValue(value: T): void {
44
- this.value = value;
45
- }
46
- }
@@ -1,3 +0,0 @@
1
- <small *ngIf="hasError" id="error-message" class="p-error block">
2
- <ng-content></ng-content>
3
- </small>
File without changes
@@ -1,22 +0,0 @@
1
- import { Component, EventEmitter, Input } from '@angular/core';
2
- import { FormControl } from '@angular/forms';
3
-
4
- @Component({
5
- selector: 'kv-error',
6
- templateUrl: './error.component.html',
7
- styleUrls: ['./error.component.scss']
8
- })
9
- export class ErrorComponent {
10
- public hasError: boolean | undefined = false;
11
-
12
- @Input() formControl!: FormControl;
13
-
14
- @Input('hasError') set setHasError(value: boolean | undefined) {
15
- this.hasError = value;
16
- this.emitError.emit(value);
17
- };
18
-
19
- emitError: EventEmitter<boolean> = new EventEmitter<boolean>();
20
-
21
- constructor() { }
22
- }
@@ -1,23 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
3
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4
-
5
- import { PrimeNgModule } from '../../modules/primeng.module';
6
-
7
- import { ErrorComponent } from './error.component';
8
-
9
- @NgModule({
10
- declarations: [
11
- ErrorComponent,
12
- ],
13
- imports: [
14
- CommonModule,
15
- FormsModule,
16
- PrimeNgModule,
17
- ReactiveFormsModule,
18
- ],
19
- exports: [
20
- ErrorComponent,
21
- ]
22
- })
23
- export class kvErrorModule { }
@@ -1,16 +0,0 @@
1
- import { Provider, forwardRef } from "@angular/core";
2
- import { NG_VALUE_ACCESSOR } from "@angular/forms";
3
- import { ComponentService } from '../services/component.service';
4
-
5
- export function ComponentProviders(ref: any): Provider[] {
6
- return [
7
- {
8
- provide: NG_VALUE_ACCESSOR,
9
- useExisting: forwardRef(() => ref),
10
- multi: true,
11
- },
12
- {
13
- provide: ComponentService
14
- }
15
- ]
16
- }
@@ -1,25 +0,0 @@
1
- import { PrimeNGConfig } from 'primeng/api';
2
-
3
- export class TranslatePrimeng {
4
- public config(config: PrimeNGConfig): void {
5
- config.ripple = true;
6
-
7
- config.setTranslation({
8
- monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
9
- monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
10
- dayNames: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sabádo'],
11
- dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'],
12
- dayNamesMin: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'],
13
- today: 'Hoje',
14
- weekHeader: 'Semana',
15
- emptyMessage: 'Nenhum resultado encontrado',
16
- emptyFilterMessage: 'Nenhum registro encontrado com o filtro informado',
17
- weak: 'Fraca',
18
- medium: 'Média',
19
- strong: 'Forte',
20
- passwordPrompt: 'Informe a senha',
21
- clear: 'Limpar',
22
- apply: 'Aplicar'
23
- });
24
- }
25
- }
@@ -1,95 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { AccordionModule } from 'primeng/accordion';
3
- import { AutoFocusModule } from 'primeng/autofocus';
4
- import { BadgeModule } from 'primeng/badge';
5
- import { ButtonModule } from 'primeng/button';
6
- import { CalendarModule } from 'primeng/calendar';
7
- import { CardModule } from 'primeng/card';
8
- import { CarouselModule } from 'primeng/carousel';
9
- import { CheckboxModule } from 'primeng/checkbox';
10
- import { ConfirmDialogModule } from 'primeng/confirmdialog';
11
- import { ConfirmationService, MessageService } from 'primeng/api';
12
- import { ContextMenuModule } from 'primeng/contextmenu';
13
- import { DialogModule } from 'primeng/dialog';
14
- import { DialogService, DynamicDialogRef, DynamicDialogConfig } from 'primeng/dynamicdialog';
15
- import { DividerModule } from 'primeng/divider';
16
- import { DropdownModule } from 'primeng/dropdown';
17
- import { DynamicDialogModule } from 'primeng/dynamicdialog';
18
- import { InputMaskModule } from 'primeng/inputmask';
19
- import { InputNumberModule } from 'primeng/inputnumber';
20
- import { InputSwitchModule } from 'primeng/inputswitch';
21
- import { InputTextModule } from 'primeng/inputtext';
22
- import { InputTextareaModule } from 'primeng/inputtextarea';
23
- import { MenuModule } from 'primeng/menu';
24
- import { MessageModule } from 'primeng/message';
25
- import { MessagesModule } from 'primeng/messages';
26
- import { MultiSelectModule } from 'primeng/multiselect';
27
- import { OverlayPanelModule } from 'primeng/overlaypanel';
28
- import { PanelModule } from 'primeng/panel';
29
- import { PasswordModule } from 'primeng/password';
30
- import { PickListModule } from 'primeng/picklist';
31
- import { RadioButtonModule } from 'primeng/radiobutton';
32
- import { RatingModule } from 'primeng/rating';
33
- import { RippleModule } from 'primeng/ripple';
34
- import { SidebarModule } from 'primeng/sidebar';
35
- import { SkeletonModule } from 'primeng/skeleton';
36
- import { SpeedDialModule } from 'primeng/speeddial';
37
- import { SplitButtonModule } from 'primeng/splitbutton';
38
- import { StepsModule } from 'primeng/steps'
39
- import { TableModule } from 'primeng/table';
40
- import { ToastModule } from 'primeng/toast';
41
- import { ToolbarModule } from 'primeng/toolbar';
42
- import { TooltipModule } from 'primeng/tooltip';
43
-
44
- @NgModule({
45
- exports: [
46
- AccordionModule,
47
- AutoFocusModule,
48
- BadgeModule,
49
- ButtonModule,
50
- CalendarModule,
51
- CardModule,
52
- CarouselModule,
53
- CheckboxModule,
54
- ConfirmDialogModule,
55
- ContextMenuModule,
56
- DialogModule,
57
- DividerModule,
58
- DropdownModule,
59
- DynamicDialogModule,
60
- InputMaskModule,
61
- InputNumberModule,
62
- InputSwitchModule,
63
- InputTextModule,
64
- InputTextareaModule,
65
- MenuModule,
66
- MessageModule,
67
- MessagesModule,
68
- MultiSelectModule,
69
- OverlayPanelModule,
70
- OverlayPanelModule,
71
- PanelModule,
72
- PasswordModule,
73
- PickListModule,
74
- RadioButtonModule,
75
- RatingModule,
76
- RippleModule,
77
- SidebarModule,
78
- SkeletonModule,
79
- SpeedDialModule,
80
- SplitButtonModule,
81
- StepsModule,
82
- TableModule,
83
- ToastModule,
84
- ToolbarModule,
85
- TooltipModule,
86
- ],
87
- providers: [
88
- ConfirmationService,
89
- DialogService,
90
- DynamicDialogRef,
91
- DynamicDialogConfig,
92
- MessageService,
93
- ]
94
- })
95
- export class PrimeNgModule { }