keevo-components 1.3.7 → 1.3.8

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 (170) hide show
  1. package/ng-package.json +7 -0
  2. package/package.json +20 -39
  3. package/src/index.ts +1 -0
  4. package/src/lib/api/base-components/base-component-button.ts +26 -0
  5. package/src/lib/api/base-components/base-component-dropdown.ts +127 -0
  6. package/src/lib/api/base-components/base-component-input.ts +91 -0
  7. package/src/lib/api/base-components/base-component.ts +46 -0
  8. package/src/lib/api/components/error/error.component.html +3 -0
  9. package/src/lib/api/components/error/error.component.scss +0 -0
  10. package/src/lib/api/components/error/error.component.ts +22 -0
  11. package/src/lib/api/components/error/kverror.module.ts +23 -0
  12. package/src/lib/api/components/table/action-item.ts +5 -0
  13. package/{lib/api/components/table/kv-menuitem.d.ts → src/lib/api/components/table/kv-menuitem.ts} +4 -3
  14. package/src/lib/api/components/table/table.config.column.ts +10 -0
  15. package/src/lib/api/components/table/table.config.ts +14 -0
  16. package/src/lib/api/components/table/table.paginate.ts +6 -0
  17. package/src/lib/api/helpers/component-providers.ts +16 -0
  18. package/src/lib/api/helpers/translate-primeng.ts +25 -0
  19. package/src/lib/api/modules/primeng.module.ts +97 -0
  20. package/src/lib/api/services/component.service.ts +22 -0
  21. package/src/lib/api/services/notification.service.ts +82 -0
  22. package/src/lib/api/services/object.service.ts +20 -0
  23. package/src/lib/buttons/button-personalize/button-personalize.component.html +9 -0
  24. package/src/lib/buttons/button-personalize/button-personalize.component.scss +0 -0
  25. package/src/lib/buttons/button-personalize/button-personalize.component.ts +13 -0
  26. package/src/lib/buttons/button-secondary/button-secondary.component.html +9 -0
  27. package/src/lib/buttons/button-secondary/button-secondary.component.scss +13 -0
  28. package/src/lib/buttons/button-secondary/button-secondary.component.ts +13 -0
  29. package/src/lib/buttons/button-success/button-success.component.html +9 -0
  30. package/src/lib/buttons/button-success/button-success.component.scss +12 -0
  31. package/src/lib/buttons/button-success/button-success.component.ts +13 -0
  32. package/src/lib/buttons/kvbutton.module.ts +22 -0
  33. package/src/lib/directives/template.directive.ts +15 -0
  34. package/src/lib/inputs/check/check.component.html +11 -0
  35. package/src/lib/inputs/check/check.component.scss +0 -0
  36. package/src/lib/inputs/check/check.component.ts +24 -0
  37. package/src/lib/inputs/dropdown/dropdown.component.html +43 -0
  38. package/src/lib/inputs/dropdown/dropdown.component.scss +0 -0
  39. package/src/lib/inputs/dropdown/dropdown.component.ts +19 -0
  40. package/src/lib/inputs/input-calendar/input-calendar.component.html +22 -0
  41. package/src/lib/inputs/input-calendar/input-calendar.component.scss +0 -0
  42. package/src/lib/inputs/input-calendar/input-calendar.component.ts +54 -0
  43. package/src/lib/inputs/input-mask/input-mask.component.html +15 -0
  44. package/src/lib/inputs/input-mask/input-mask.component.scss +0 -0
  45. package/src/lib/inputs/input-mask/input-mask.component.ts +20 -0
  46. package/src/lib/inputs/input-number/input-number.component.html +15 -0
  47. package/src/lib/inputs/input-number/input-number.component.scss +0 -0
  48. package/src/lib/inputs/input-number/input-number.component.ts +51 -0
  49. package/src/lib/inputs/input-password/input-password.component.html +18 -0
  50. package/src/lib/inputs/input-password/input-password.component.scss +0 -0
  51. package/src/lib/inputs/input-password/input-password.component.ts +23 -0
  52. package/src/lib/inputs/input-text/input-text.component.html +14 -0
  53. package/src/lib/inputs/input-text/input-text.component.scss +18 -0
  54. package/src/lib/inputs/input-text/input-text.component.ts +17 -0
  55. package/src/lib/inputs/input-textarea/input-textarea.component.html +17 -0
  56. package/src/lib/inputs/input-textarea/input-textarea.component.scss +0 -0
  57. package/src/lib/inputs/input-textarea/input-textarea.component.ts +33 -0
  58. package/src/lib/inputs/input-time/input-time.component.html +18 -0
  59. package/src/lib/inputs/input-time/input-time.component.scss +0 -0
  60. package/src/lib/inputs/input-time/input-time.component.ts +20 -0
  61. package/src/lib/inputs/kvinputs.module.ts +53 -0
  62. package/src/lib/inputs/multi-select/multi-select.component.html +21 -0
  63. package/src/lib/inputs/multi-select/multi-select.component.scss +0 -0
  64. package/src/lib/inputs/multi-select/multi-select.component.ts +44 -0
  65. package/src/lib/inputs/switch/switch.component.html +11 -0
  66. package/src/lib/inputs/switch/switch.component.scss +3 -0
  67. package/src/lib/inputs/switch/switch.component.ts +24 -0
  68. package/src/lib/keevo-components.module.ts +20 -0
  69. package/src/lib/pipes/codigofile.pipe.ts +15 -0
  70. package/src/lib/pipes/cpfcnpj.pipe.ts +21 -0
  71. package/src/lib/pipes/pipes.module.ts +22 -0
  72. package/src/lib/pipes/telefone.pipe.ts +38 -0
  73. package/src/lib/styles-components.scss +3 -0
  74. package/src/lib/table/kvtable.module.ts +20 -0
  75. package/src/lib/table/table.component.html +189 -0
  76. package/src/lib/table/table.component.scss +21 -0
  77. package/src/lib/table/table.component.spec.ts +28 -0
  78. package/src/lib/table/table.component.ts +211 -0
  79. package/{public-api.d.ts → src/public-api.ts} +11 -4
  80. package/tsconfig.lib.json +14 -0
  81. package/tsconfig.lib.prod.json +10 -0
  82. package/tsconfig.spec.json +14 -0
  83. package/esm2020/keevo-components.mjs +0 -5
  84. package/esm2020/lib/api/base-components/base-component-button.mjs +0 -36
  85. package/esm2020/lib/api/base-components/base-component-dropdown.mjs +0 -116
  86. package/esm2020/lib/api/base-components/base-component-input.mjs +0 -77
  87. package/esm2020/lib/api/base-components/base-component.mjs +0 -49
  88. package/esm2020/lib/api/components/error/error.component.mjs +0 -26
  89. package/esm2020/lib/api/components/error/kverror.module.mjs +0 -35
  90. package/esm2020/lib/api/components/table/action-item.mjs +0 -2
  91. package/esm2020/lib/api/components/table/kv-menuitem.mjs +0 -3
  92. package/esm2020/lib/api/components/table/table.config.column.mjs +0 -2
  93. package/esm2020/lib/api/components/table/table.config.mjs +0 -2
  94. package/esm2020/lib/api/components/table/table.paginate.mjs +0 -9
  95. package/esm2020/lib/api/helpers/component-providers.mjs +0 -16
  96. package/esm2020/lib/api/helpers/translate-primeng.mjs +0 -23
  97. package/esm2020/lib/api/modules/primeng.module.mjs +0 -191
  98. package/esm2020/lib/api/services/component.service.mjs +0 -27
  99. package/esm2020/lib/api/services/notification.service.mjs +0 -67
  100. package/esm2020/lib/api/services/object.service.mjs +0 -26
  101. package/esm2020/lib/buttons/button-personalize/button-personalize.component.mjs +0 -17
  102. package/esm2020/lib/buttons/button-secondary/button-secondary.component.mjs +0 -17
  103. package/esm2020/lib/buttons/button-success/button-success.component.mjs +0 -17
  104. package/esm2020/lib/buttons/kvbutton.module.mjs +0 -34
  105. package/esm2020/lib/directives/template.directive.mjs +0 -24
  106. package/esm2020/lib/inputs/check/check.component.mjs +0 -26
  107. package/esm2020/lib/inputs/dropdown/dropdown.component.mjs +0 -26
  108. package/esm2020/lib/inputs/input-calendar/input-calendar.component.mjs +0 -62
  109. package/esm2020/lib/inputs/input-mask/input-mask.component.mjs +0 -22
  110. package/esm2020/lib/inputs/input-number/input-number.component.mjs +0 -56
  111. package/esm2020/lib/inputs/input-password/input-password.component.mjs +0 -32
  112. package/esm2020/lib/inputs/input-text/input-text.component.mjs +0 -20
  113. package/esm2020/lib/inputs/input-textarea/input-textarea.component.mjs +0 -42
  114. package/esm2020/lib/inputs/input-time/input-time.component.mjs +0 -23
  115. package/esm2020/lib/inputs/kvinputs.module.mjs +0 -89
  116. package/esm2020/lib/inputs/multi-select/multi-select.component.mjs +0 -50
  117. package/esm2020/lib/inputs/switch/switch.component.mjs +0 -26
  118. package/esm2020/lib/keevo-components.module.mjs +0 -35
  119. package/esm2020/lib/pipes/codigofile.pipe.mjs +0 -19
  120. package/esm2020/lib/pipes/cpfcnpj.pipe.mjs +0 -25
  121. package/esm2020/lib/pipes/pipes.module.mjs +0 -34
  122. package/esm2020/lib/pipes/telefone.pipe.mjs +0 -45
  123. package/esm2020/lib/table/kvtable.module.mjs +0 -28
  124. package/esm2020/lib/table/table.component.mjs +0 -194
  125. package/esm2020/public-api.mjs +0 -44
  126. package/fesm2015/keevo-components.mjs +0 -1481
  127. package/fesm2015/keevo-components.mjs.map +0 -1
  128. package/fesm2020/keevo-components.mjs +0 -1490
  129. package/fesm2020/keevo-components.mjs.map +0 -1
  130. package/index.d.ts +0 -5
  131. package/lib/api/base-components/base-component-button.d.ts +0 -14
  132. package/lib/api/base-components/base-component-dropdown.d.ts +0 -31
  133. package/lib/api/base-components/base-component-input.d.ts +0 -26
  134. package/lib/api/base-components/base-component.d.ts +0 -21
  135. package/lib/api/components/error/error.component.d.ts +0 -12
  136. package/lib/api/components/error/kverror.module.d.ts +0 -10
  137. package/lib/api/components/table/action-item.d.ts +0 -5
  138. package/lib/api/components/table/table.config.column.d.ts +0 -10
  139. package/lib/api/components/table/table.config.d.ts +0 -12
  140. package/lib/api/components/table/table.paginate.d.ts +0 -6
  141. package/lib/api/helpers/component-providers.d.ts +0 -2
  142. package/lib/api/helpers/translate-primeng.d.ts +0 -4
  143. package/lib/api/modules/primeng.module.d.ts +0 -46
  144. package/lib/api/services/component.service.d.ts +0 -11
  145. package/lib/api/services/notification.service.d.ts +0 -25
  146. package/lib/api/services/object.service.d.ts +0 -8
  147. package/lib/buttons/button-personalize/button-personalize.component.d.ts +0 -7
  148. package/lib/buttons/button-secondary/button-secondary.component.d.ts +0 -7
  149. package/lib/buttons/button-success/button-success.component.d.ts +0 -7
  150. package/lib/buttons/kvbutton.module.d.ts +0 -10
  151. package/lib/directives/template.directive.d.ts +0 -11
  152. package/lib/inputs/check/check.component.d.ts +0 -11
  153. package/lib/inputs/dropdown/dropdown.component.d.ts +0 -9
  154. package/lib/inputs/input-calendar/input-calendar.component.d.ts +0 -21
  155. package/lib/inputs/input-mask/input-mask.component.d.ts +0 -10
  156. package/lib/inputs/input-number/input-number.component.d.ts +0 -18
  157. package/lib/inputs/input-password/input-password.component.d.ts +0 -13
  158. package/lib/inputs/input-text/input-text.component.d.ts +0 -9
  159. package/lib/inputs/input-textarea/input-textarea.component.d.ts +0 -16
  160. package/lib/inputs/input-time/input-time.component.d.ts +0 -10
  161. package/lib/inputs/kvinputs.module.d.ts +0 -21
  162. package/lib/inputs/multi-select/multi-select.component.d.ts +0 -20
  163. package/lib/inputs/switch/switch.component.d.ts +0 -11
  164. package/lib/keevo-components.module.d.ts +0 -9
  165. package/lib/pipes/codigofile.pipe.d.ts +0 -7
  166. package/lib/pipes/cpfcnpj.pipe.d.ts +0 -7
  167. package/lib/pipes/pipes.module.d.ts +0 -10
  168. package/lib/pipes/telefone.pipe.d.ts +0 -7
  169. package/lib/table/kvtable.module.d.ts +0 -9
  170. package/lib/table/table.component.d.ts +0 -56
@@ -0,0 +1,7 @@
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/package.json CHANGED
@@ -1,39 +1,20 @@
1
- {
2
- "name": "keevo-components",
3
- "version": "1.3.7",
4
- "peerDependencies": {
5
- "@angular/common": "^15.2.0",
6
- "@angular/core": "^15.2.0"
7
- },
8
- "dependencies": {
9
- "tslib": "^2.3.0"
10
- },
11
- "sideEffects": false,
12
- "description": "Componentes utilizados no frontend dos sistemas da Keevo Software.",
13
- "author": {
14
- "name": "Rafael",
15
- "url": "https://github.com/rafaelalvesmds"
16
- },
17
- "keywords": [
18
- "keevo components library"
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
+ {
2
+ "name": "keevo-components",
3
+ "version": "1.3.8",
4
+ "peerDependencies": {
5
+ "@angular/common": "^15.2.0",
6
+ "@angular/core": "^15.2.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false,
12
+ "description": "Componentes utilizados no frontend dos sistemas da Keevo Software.",
13
+ "author": {
14
+ "name": "Rafael",
15
+ "url": "https://github.com/rafaelalvesmds"
16
+ },
17
+ "keywords": [
18
+ "keevo components library"
19
+ ]
20
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './public-api';
@@ -0,0 +1,26 @@
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
+ @Input() color: string = 'bg-blue-100';
18
+
19
+ @Output() onClick: EventEmitter<any> = new EventEmitter();
20
+
21
+ constructor() { }
22
+
23
+ click(event: any): void {
24
+ this.onClick.emit();
25
+ }
26
+ }
@@ -0,0 +1,127 @@
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
+ this.registerOnTouched(() => {});
45
+ }
46
+
47
+ override ngOnInit(): void {
48
+ super.ngOnInit();
49
+ // this.carregarCombo();
50
+ this.setPlaceHolder('Selecione um valor');
51
+ }
52
+
53
+ protected addClick(event: Event) {
54
+ this.onAddClick.emit(event);
55
+ }
56
+
57
+ private carregarCombo(): void {
58
+ this.listar().subscribe({
59
+ next: (data: any) => {
60
+ this.options = data;
61
+ this.filteredOptions = data;
62
+ },
63
+ error: (error: any) => {},
64
+ });
65
+ }
66
+
67
+ public filterOptions(field: string, value: any): void {
68
+ if (this.options) {
69
+ let lista = ObjectService.filterObject(this.options, field, value);
70
+ if (lista?.length > 0) {
71
+ of(lista).subscribe((opts: any[]) => {
72
+ this.filteredOptions = opts;
73
+ });
74
+ } else this.filteredOptions = [];
75
+ }
76
+ }
77
+
78
+ protected listar(): any {}
79
+
80
+ onInputClick(event: any) {
81
+ this.onClick.emit(event);
82
+ }
83
+
84
+ protected openDialog(
85
+ componentType: Type<any>,
86
+ width?: string,
87
+ height?: string
88
+ ) {
89
+ const ref = this.dialogService.open(componentType, {
90
+ width: width || '70%',
91
+ height: height,
92
+ closable: false,
93
+ maximizable: true,
94
+ data: { popup: true },
95
+ });
96
+
97
+ ref.onClose.subscribe((id: any) => {
98
+ if (id) {
99
+ this.listar().subscribe((data: any) => {
100
+ this.options = data;
101
+ this.filteredOptions = data;
102
+ if (id) this.formControl?.setValue(id);
103
+ });
104
+ }
105
+ });
106
+ }
107
+
108
+ protected selectionValue(event: any) {
109
+ this.onSelectionValue.emit(event);
110
+
111
+ let currentItem = null;
112
+
113
+ const controlName = this.getName(this.formControl as FormControl);
114
+ if (controlName)
115
+ currentItem = ObjectService.findObject(
116
+ this.options,
117
+ controlName,
118
+ event.value
119
+ );
120
+
121
+ this.onSelectionChange.emit(currentItem);
122
+ }
123
+
124
+ protected setPlaceHolder(p: string) {
125
+ if (!this.placeholder) this.placeholder = p;
126
+ }
127
+ }
@@ -0,0 +1,91 @@
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
+ }
@@ -0,0 +1,46 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ <small *ngIf="hasError" id="error-message" class="p-error block absolute">
2
+ <ng-content></ng-content>
3
+ </small>
@@ -0,0 +1,22 @@
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
+ }
@@ -0,0 +1,23 @@
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 { }
@@ -0,0 +1,5 @@
1
+ export interface ActionItem {
2
+ label: string;
3
+ icon?: string;
4
+ command?: (event?: any) => void;
5
+ }
@@ -1,5 +1,6 @@
1
1
  import { MenuItem } from "primeng/api/menuitem";
2
+
2
3
  export interface KvMenuItem extends MenuItem {
3
- dynamicfields?: any;
4
- [key: string]: any;
5
- }
4
+ dynamicfields?: any;
5
+ [key: string]: any;
6
+ };
@@ -0,0 +1,10 @@
1
+ export interface TableConfigColumn {
2
+ field: string;
3
+ header: string;
4
+ fieldType?: string;
5
+ width?: string;
6
+ pipe?: 'date' | 'decimal' | 'cpfcnpj' | 'telefone' | 'codigofipe';
7
+ sortable: boolean;
8
+ grouped?: boolean;
9
+ centralize?: boolean;
10
+ }
@@ -0,0 +1,14 @@
1
+ import { MenuItem } from 'primeng/api';
2
+ import { TableConfigColumn } from './table.config.column';
3
+ import { KvMenuItem } from './kv-menuitem';
4
+
5
+ export interface TableConfig {
6
+ actions: KvMenuItem[];
7
+ columns: TableConfigColumn[];
8
+ title?: string;
9
+ lazy: boolean;
10
+ fieldGroup?: string;
11
+ enableCation?: boolean;
12
+ enableFilter?: boolean;
13
+ enableSelect?: boolean;
14
+ }
@@ -0,0 +1,6 @@
1
+ export class TablePaginate {
2
+ paginaInicial: number = 1;
3
+ tamanhoPagina: number = 10;
4
+ termoPesquisa: string = '';
5
+ ordenacao: string = '';
6
+ }
@@ -0,0 +1,16 @@
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
+ }
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1,97 @@
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
+ import { OverlayModule } from 'primeng/overlay';
44
+
45
+ @NgModule({
46
+ exports: [
47
+ AccordionModule,
48
+ AutoFocusModule,
49
+ BadgeModule,
50
+ ButtonModule,
51
+ CalendarModule,
52
+ CardModule,
53
+ CarouselModule,
54
+ CheckboxModule,
55
+ ConfirmDialogModule,
56
+ ContextMenuModule,
57
+ DialogModule,
58
+ DividerModule,
59
+ DropdownModule,
60
+ DynamicDialogModule,
61
+ InputMaskModule,
62
+ InputNumberModule,
63
+ InputSwitchModule,
64
+ InputTextModule,
65
+ InputTextareaModule,
66
+ MenuModule,
67
+ MessageModule,
68
+ MessagesModule,
69
+ MultiSelectModule,
70
+ OverlayPanelModule,
71
+ OverlayPanelModule,
72
+ PanelModule,
73
+ PasswordModule,
74
+ PickListModule,
75
+ RadioButtonModule,
76
+ RatingModule,
77
+ RippleModule,
78
+ SidebarModule,
79
+ SkeletonModule,
80
+ SpeedDialModule,
81
+ SplitButtonModule,
82
+ StepsModule,
83
+ TableModule,
84
+ ToastModule,
85
+ ToolbarModule,
86
+ TooltipModule,
87
+ OverlayModule
88
+ ],
89
+ providers: [
90
+ ConfirmationService,
91
+ DialogService,
92
+ DynamicDialogRef,
93
+ DynamicDialogConfig,
94
+ MessageService,
95
+ ]
96
+ })
97
+ export class PrimeNgModule { }
@@ -0,0 +1,22 @@
1
+ import { ChangeDetectorRef, Injectable, Injector } from '@angular/core';
2
+ import { FormControl, FormControlName, FormGroupDirective, NgControl } from '@angular/forms';
3
+
4
+ @Injectable()
5
+ export class ComponentService {
6
+
7
+ constructor(public readonly injector: Injector, public changeDetectorRef: ChangeDetectorRef) { }
8
+
9
+ getFormControl(): FormControl<any> | undefined {
10
+ try {
11
+ const control = this.injector.get(NgControl);
12
+ if (control.constructor === FormControlName) {
13
+ return this.injector.get(FormGroupDirective).getControl(control as FormControlName);
14
+ }
15
+
16
+ return undefined;
17
+ }
18
+ catch(ex){
19
+ return undefined;
20
+ }
21
+ }
22
+ }