keevo-components 0.0.7 → 0.0.9

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 (124) hide show
  1. package/ng-package.json +7 -0
  2. package/package.json +3 -22
  3. package/src/index.ts +1 -0
  4. package/src/lib/api/base-components/base-component-button.ts +25 -0
  5. package/src/lib/api/base-components/base-component-dropdown.ts +126 -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/helpers/component-providers.ts +16 -0
  13. package/src/lib/api/helpers/translate-primeng.ts +25 -0
  14. package/src/lib/api/modules/primeng.module.ts +95 -0
  15. package/src/lib/api/services/component.service.ts +22 -0
  16. package/src/lib/api/services/object.service.ts +20 -0
  17. package/src/lib/buttons/button-secondary/button-secondary.component.html +9 -0
  18. package/src/lib/buttons/button-secondary/button-secondary.component.scss +13 -0
  19. package/src/lib/buttons/button-secondary/button-secondary.component.ts +13 -0
  20. package/src/lib/buttons/button-success/button-success.component.html +9 -0
  21. package/src/lib/buttons/button-success/button-success.component.scss +12 -0
  22. package/src/lib/buttons/button-success/button-success.component.ts +13 -0
  23. package/src/lib/buttons/kvbutton.module.ts +19 -0
  24. package/src/lib/inputs/check/check.component.html +11 -0
  25. package/src/lib/inputs/check/check.component.scss +0 -0
  26. package/src/lib/inputs/check/check.component.ts +24 -0
  27. package/src/lib/inputs/dropdown/dropdown.component.html +41 -0
  28. package/src/lib/inputs/dropdown/dropdown.component.scss +0 -0
  29. package/src/lib/inputs/dropdown/dropdown.component.ts +19 -0
  30. package/src/lib/inputs/input-calendar/input-calendar.component.html +22 -0
  31. package/src/lib/inputs/input-calendar/input-calendar.component.scss +0 -0
  32. package/src/lib/inputs/input-calendar/input-calendar.component.ts +54 -0
  33. package/src/lib/inputs/input-mask/input-mask.component.html +15 -0
  34. package/src/lib/inputs/input-mask/input-mask.component.scss +0 -0
  35. package/src/lib/inputs/input-mask/input-mask.component.ts +20 -0
  36. package/src/lib/inputs/input-number/input-number.component.html +15 -0
  37. package/src/lib/inputs/input-number/input-number.component.scss +0 -0
  38. package/src/lib/inputs/input-number/input-number.component.ts +51 -0
  39. package/src/lib/inputs/input-password/input-password.component.html +18 -0
  40. package/src/lib/inputs/input-password/input-password.component.scss +0 -0
  41. package/src/lib/inputs/input-password/input-password.component.ts +23 -0
  42. package/src/lib/inputs/input-text/input-text.component.html +14 -0
  43. package/src/lib/inputs/input-text/input-text.component.scss +18 -0
  44. package/src/lib/inputs/input-text/input-text.component.ts +17 -0
  45. package/src/lib/inputs/input-textarea/input-textarea.component.html +17 -0
  46. package/src/lib/inputs/input-textarea/input-textarea.component.scss +0 -0
  47. package/src/lib/inputs/input-textarea/input-textarea.component.ts +33 -0
  48. package/src/lib/inputs/input-time/input-time.component.html +18 -0
  49. package/src/lib/inputs/input-time/input-time.component.scss +0 -0
  50. package/src/lib/inputs/input-time/input-time.component.ts +20 -0
  51. package/src/lib/inputs/kvinputs.module.ts +53 -0
  52. package/src/lib/inputs/multi-select/multi-select.component.html +21 -0
  53. package/src/lib/inputs/multi-select/multi-select.component.scss +0 -0
  54. package/src/lib/inputs/multi-select/multi-select.component.ts +44 -0
  55. package/src/lib/inputs/switch/switch.component.html +11 -0
  56. package/src/lib/inputs/switch/switch.component.scss +3 -0
  57. package/src/lib/inputs/switch/switch.component.ts +24 -0
  58. package/src/lib/keevo-components.module.ts +17 -0
  59. package/{public-api.d.ts → src/public-api.ts} +34 -27
  60. package/tsconfig.lib.json +14 -0
  61. package/tsconfig.lib.prod.json +10 -0
  62. package/tsconfig.spec.json +14 -0
  63. package/esm2020/keevo-components.mjs +0 -5
  64. package/esm2020/lib/api/base-components/base-component-button.mjs +0 -33
  65. package/esm2020/lib/api/base-components/base-component-dropdown.mjs +0 -115
  66. package/esm2020/lib/api/base-components/base-component-input.mjs +0 -77
  67. package/esm2020/lib/api/base-components/base-component.mjs +0 -49
  68. package/esm2020/lib/api/components/error/error.component.mjs +0 -26
  69. package/esm2020/lib/api/components/error/kverror.module.mjs +0 -35
  70. package/esm2020/lib/api/helpers/component-providers.mjs +0 -16
  71. package/esm2020/lib/api/helpers/translate-primeng.mjs +0 -23
  72. package/esm2020/lib/api/modules/primeng.module.mjs +0 -187
  73. package/esm2020/lib/api/services/component.service.mjs +0 -27
  74. package/esm2020/lib/api/services/object.service.mjs +0 -26
  75. package/esm2020/lib/buttons/button-secondary/button-secondary.component.mjs +0 -17
  76. package/esm2020/lib/buttons/button-success/button-success.component.mjs +0 -17
  77. package/esm2020/lib/buttons/kvbutton.module.mjs +0 -29
  78. package/esm2020/lib/inputs/check/check.component.mjs +0 -26
  79. package/esm2020/lib/inputs/dropdown/dropdown.component.mjs +0 -26
  80. package/esm2020/lib/inputs/input-calendar/input-calendar.component.mjs +0 -62
  81. package/esm2020/lib/inputs/input-mask/input-mask.component.mjs +0 -22
  82. package/esm2020/lib/inputs/input-number/input-number.component.mjs +0 -56
  83. package/esm2020/lib/inputs/input-password/input-password.component.mjs +0 -32
  84. package/esm2020/lib/inputs/input-text/input-text.component.mjs +0 -20
  85. package/esm2020/lib/inputs/input-textarea/input-textarea.component.mjs +0 -42
  86. package/esm2020/lib/inputs/input-time/input-time.component.mjs +0 -23
  87. package/esm2020/lib/inputs/kvinputs.module.mjs +0 -89
  88. package/esm2020/lib/inputs/multi-select/multi-select.component.mjs +0 -50
  89. package/esm2020/lib/inputs/switch/switch.component.mjs +0 -26
  90. package/esm2020/lib/keevo-components.module.mjs +0 -28
  91. package/esm2020/public-api.mjs +0 -31
  92. package/esm2020/public_api.mjs +0 -31
  93. package/fesm2015/keevo-components.mjs +0 -1050
  94. package/fesm2015/keevo-components.mjs.map +0 -1
  95. package/fesm2020/keevo-components.mjs +0 -1046
  96. package/fesm2020/keevo-components.mjs.map +0 -1
  97. package/index.d.ts +0 -5
  98. package/lib/api/base-components/base-component-button.d.ts +0 -13
  99. package/lib/api/base-components/base-component-dropdown.d.ts +0 -31
  100. package/lib/api/base-components/base-component-input.d.ts +0 -26
  101. package/lib/api/base-components/base-component.d.ts +0 -21
  102. package/lib/api/components/error/error.component.d.ts +0 -12
  103. package/lib/api/components/error/kverror.module.d.ts +0 -10
  104. package/lib/api/helpers/component-providers.d.ts +0 -2
  105. package/lib/api/helpers/translate-primeng.d.ts +0 -4
  106. package/lib/api/modules/primeng.module.d.ts +0 -45
  107. package/lib/api/services/component.service.d.ts +0 -11
  108. package/lib/api/services/object.service.d.ts +0 -8
  109. package/lib/buttons/button-secondary/button-secondary.component.d.ts +0 -7
  110. package/lib/buttons/button-success/button-success.component.d.ts +0 -7
  111. package/lib/buttons/kvbutton.module.d.ts +0 -9
  112. package/lib/inputs/check/check.component.d.ts +0 -11
  113. package/lib/inputs/dropdown/dropdown.component.d.ts +0 -9
  114. package/lib/inputs/input-calendar/input-calendar.component.d.ts +0 -21
  115. package/lib/inputs/input-mask/input-mask.component.d.ts +0 -10
  116. package/lib/inputs/input-number/input-number.component.d.ts +0 -18
  117. package/lib/inputs/input-password/input-password.component.d.ts +0 -12
  118. package/lib/inputs/input-text/input-text.component.d.ts +0 -9
  119. package/lib/inputs/input-textarea/input-textarea.component.d.ts +0 -16
  120. package/lib/inputs/input-time/input-time.component.d.ts +0 -10
  121. package/lib/inputs/kvinputs.module.d.ts +0 -21
  122. package/lib/inputs/multi-select/multi-select.component.d.ts +0 -20
  123. package/lib/inputs/switch/switch.component.d.ts +0 -11
  124. package/lib/keevo-components.module.d.ts +0 -8
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "keevo-components",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^15.2.0",
6
6
  "@angular/core": "^15.2.0"
@@ -16,24 +16,5 @@
16
16
  },
17
17
  "keywords": [
18
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
- }
19
+ ]
20
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './public-api';
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1,126 @@
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
+ }
@@ -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">
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,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,95 @@
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 { }
@@ -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
+ }
@@ -0,0 +1,20 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ @Injectable({
4
+ providedIn: 'root'
5
+ })
6
+ export class ObjectService {
7
+ static filterObject(array: any, propertyName: string, value: any) {
8
+ return array.filter((e: any) => {
9
+ return e[propertyName] === value;
10
+ });
11
+ }
12
+ static findObject(array: any, propertyName: string, value: any) {
13
+ return array.find((e: any) => {
14
+ return e[propertyName] === value;
15
+ });
16
+ }
17
+ static getProperty<T>(obj: T, propertyName: string) {
18
+ return obj[(propertyName as keyof typeof obj)];
19
+ }
20
+ }
@@ -0,0 +1,9 @@
1
+ <button
2
+ pButton
3
+ pRipple
4
+ class="btn-secondary"
5
+ [icon]="icon"
6
+ [label]="label"
7
+ [loading]="loading"
8
+ (click)="click($event)">
9
+ </button>
@@ -0,0 +1,13 @@
1
+ .btn-secondary {
2
+ background-color: #f2f3f5 !important;
3
+ color: rgba(0, 0, 0, .87) !important;
4
+
5
+ &:hover {
6
+ background-color: #ef5350 !important;
7
+ color: #FFF !important;
8
+ }
9
+
10
+ &:disabled {
11
+ pointer-events: none;
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ import { Component } from '@angular/core';
2
+ import { BaseComponentButton } from '../../api/base-components/base-component-button';
3
+
4
+ @Component({
5
+ selector: 'kv-button-secondary',
6
+ templateUrl: './button-secondary.component.html',
7
+ styleUrls: ['./button-secondary.component.scss']
8
+ })
9
+ export class ButtonSecondaryComponent extends BaseComponentButton {
10
+ constructor() {
11
+ super();
12
+ }
13
+ }
@@ -0,0 +1,9 @@
1
+ <button
2
+ pButton
3
+ pRipple
4
+ class="btn-success"
5
+ [icon]="icon"
6
+ [label]="label"
7
+ [loading]="loading"
8
+ (click)="click($event)">
9
+ </button>
@@ -0,0 +1,12 @@
1
+ .btn-success {
2
+ background-color: #29b92d !important;
3
+ color: #fff !important;
4
+
5
+ &:hover {
6
+ background-color: #229925 !important;
7
+ }
8
+
9
+ &:disabled {
10
+ pointer-events: none;
11
+ }
12
+ }
@@ -0,0 +1,13 @@
1
+ import { Component } from '@angular/core';
2
+ import { BaseComponentButton } from '../../api/base-components/base-component-button';
3
+
4
+ @Component({
5
+ selector: 'kv-button-success',
6
+ templateUrl: './button-success.component.html',
7
+ styleUrls: ['./button-success.component.scss']
8
+ })
9
+ export class ButtonSuccessComponent extends BaseComponentButton {
10
+ constructor() {
11
+ super();
12
+ }
13
+ }
@@ -0,0 +1,19 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { ButtonSecondaryComponent } from './button-secondary/button-secondary.component';
3
+ import { ButtonSuccessComponent } from './button-success/button-success.component';
4
+ import { PrimeNgModule } from '../api/modules/primeng.module';
5
+
6
+ @NgModule({
7
+ declarations: [
8
+ ButtonSecondaryComponent,
9
+ ButtonSuccessComponent
10
+ ],
11
+ imports: [
12
+ PrimeNgModule
13
+ ],
14
+ exports: [
15
+ ButtonSecondaryComponent,
16
+ ButtonSuccessComponent
17
+ ]
18
+ })
19
+ export class KvButtonsModule { }