appproject-components 1.0.47 → 1.0.48

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 (153) hide show
  1. package/esm2022/appproject-components.mjs +5 -0
  2. package/esm2022/lib/appproject-components.component.mjs +22 -0
  3. package/esm2022/lib/appproject-components.module.mjs +159 -0
  4. package/esm2022/lib/appproject-components.service.mjs +14 -0
  5. package/esm2022/lib/baseInputComponent.mjs +69 -0
  6. package/esm2022/lib/buttons/baseBtnComponent.mjs +63 -0
  7. package/esm2022/lib/buttons/btn-action/btn-action.component.mjs +55 -0
  8. package/esm2022/lib/buttons/btn-cancelar/btn-cancelar.component.mjs +25 -0
  9. package/esm2022/lib/buttons/btn-excluir/btn-excluir.component.mjs +29 -0
  10. package/esm2022/lib/buttons/btn-novo/btn-novo.component.mjs +33 -0
  11. package/esm2022/lib/buttons/btn-salvar/btn-salvar.component.mjs +19 -0
  12. package/esm2022/lib/entity-edit/entity-edit.component.mjs +53 -0
  13. package/esm2022/lib/grid-view/grid-view.component.mjs +275 -0
  14. package/esm2022/lib/input-area/input-area.component.mjs +72 -0
  15. package/esm2022/lib/input-arquivo/input-arquivo.component.mjs +154 -0
  16. package/esm2022/lib/input-cep/input-cep.component.mjs +180 -0
  17. package/esm2022/lib/input-checkbox/input-checkbox.component.mjs +51 -0
  18. package/esm2022/lib/input-format/input-format.component.mjs +138 -0
  19. package/esm2022/lib/input-pesquisa/input-pesquisa.component.mjs +557 -0
  20. package/esm2022/lib/input-radio/input-radio.component.mjs +58 -0
  21. package/esm2022/lib/input-select/input-select.component.mjs +110 -0
  22. package/esm2022/lib/input-text/input-text.component.mjs +88 -0
  23. package/esm2022/lib/input-valor/input-valor.component.mjs +161 -0
  24. package/esm2022/lib/lib-config.mjs +2 -0
  25. package/esm2022/lib/model-treeview/model-treeview.component.mjs +126 -0
  26. package/esm2022/lib/tree-view/tree-view.component.mjs +104 -0
  27. package/esm2022/lib/tree-view-nivel/tree-view-nivel.component.mjs +50 -0
  28. package/esm2022/public-api.mjs +30 -0
  29. package/fesm2022/appproject-components.mjs +2531 -0
  30. package/fesm2022/appproject-components.mjs.map +1 -0
  31. package/index.d.ts +5 -0
  32. package/lib/appproject-components.component.d.ts +8 -0
  33. package/lib/appproject-components.module.d.ts +36 -0
  34. package/lib/appproject-components.service.d.ts +6 -0
  35. package/lib/baseInputComponent.d.ts +28 -0
  36. package/lib/buttons/baseBtnComponent.d.ts +19 -0
  37. package/lib/buttons/btn-action/btn-action.component.d.ts +21 -0
  38. package/lib/buttons/btn-cancelar/btn-cancelar.component.d.ts +10 -0
  39. package/lib/buttons/btn-excluir/btn-excluir.component.d.ts +12 -0
  40. package/lib/buttons/btn-novo/btn-novo.component.d.ts +13 -0
  41. package/lib/buttons/btn-salvar/btn-salvar.component.d.ts +9 -0
  42. package/lib/entity-edit/entity-edit.component.d.ts +22 -0
  43. package/lib/grid-view/grid-view.component.d.ts +52 -0
  44. package/lib/input-area/input-area.component.d.ts +24 -0
  45. package/lib/input-arquivo/input-arquivo.component.d.ts +43 -0
  46. package/lib/input-cep/input-cep.component.d.ts +29 -0
  47. package/lib/input-checkbox/input-checkbox.component.d.ts +21 -0
  48. package/lib/input-format/input-format.component.d.ts +27 -0
  49. package/lib/input-pesquisa/input-pesquisa.component.d.ts +69 -0
  50. package/lib/input-radio/input-radio.component.d.ts +23 -0
  51. package/lib/input-select/input-select.component.d.ts +32 -0
  52. package/lib/input-text/input-text.component.d.ts +33 -0
  53. package/lib/input-valor/input-valor.component.d.ts +29 -0
  54. package/{src/lib/lib-config.ts → lib/lib-config.d.ts} +3 -4
  55. package/lib/model-treeview/model-treeview.component.d.ts +39 -0
  56. package/lib/tree-view/tree-view.component.d.ts +23 -0
  57. package/lib/tree-view-nivel/tree-view-nivel.component.d.ts +17 -0
  58. package/package.json +26 -15
  59. package/{src/public-api.ts → public-api.d.ts} +24 -30
  60. package/karma.conf.js +0 -44
  61. package/ng-package.json +0 -7
  62. package/src/lib/appproject-components.component.spec.ts +0 -23
  63. package/src/lib/appproject-components.component.ts +0 -20
  64. package/src/lib/appproject-components.module.ts +0 -106
  65. package/src/lib/appproject-components.service.spec.ts +0 -16
  66. package/src/lib/appproject-components.service.ts +0 -9
  67. package/src/lib/baseComponent.scss +0 -162
  68. package/src/lib/baseInputComponent.ts +0 -35
  69. package/src/lib/buttons/baseBtnComponent.ts +0 -38
  70. package/src/lib/buttons/btn-action/btn-action.component.html +0 -11
  71. package/src/lib/buttons/btn-action/btn-action.component.scss +0 -7
  72. package/src/lib/buttons/btn-action/btn-action.component.spec.ts +0 -24
  73. package/src/lib/buttons/btn-action/btn-action.component.ts +0 -31
  74. package/src/lib/buttons/btn-cancelar/btn-cancelar.component.html +0 -14
  75. package/src/lib/buttons/btn-cancelar/btn-cancelar.component.scss +0 -5
  76. package/src/lib/buttons/btn-cancelar/btn-cancelar.component.spec.ts +0 -24
  77. package/src/lib/buttons/btn-cancelar/btn-cancelar.component.ts +0 -19
  78. package/src/lib/buttons/btn-excluir/btn-excluir.component.html +0 -6
  79. package/src/lib/buttons/btn-excluir/btn-excluir.component.scss +0 -5
  80. package/src/lib/buttons/btn-excluir/btn-excluir.component.spec.ts +0 -24
  81. package/src/lib/buttons/btn-excluir/btn-excluir.component.ts +0 -18
  82. package/src/lib/buttons/btn-novo/btn-novo.component.html +0 -14
  83. package/src/lib/buttons/btn-novo/btn-novo.component.scss +0 -8
  84. package/src/lib/buttons/btn-novo/btn-novo.component.spec.ts +0 -24
  85. package/src/lib/buttons/btn-novo/btn-novo.component.ts +0 -20
  86. package/src/lib/buttons/btn-salvar/btn-salvar.component.html +0 -8
  87. package/src/lib/buttons/btn-salvar/btn-salvar.component.scss +0 -5
  88. package/src/lib/buttons/btn-salvar/btn-salvar.component.spec.ts +0 -24
  89. package/src/lib/buttons/btn-salvar/btn-salvar.component.ts +0 -16
  90. package/src/lib/entity-edit/entity-edit.component.html +0 -143
  91. package/src/lib/entity-edit/entity-edit.component.scss +0 -4
  92. package/src/lib/entity-edit/entity-edit.component.spec.ts +0 -23
  93. package/src/lib/entity-edit/entity-edit.component.ts +0 -43
  94. package/src/lib/grid-view/grid-view.component.html +0 -116
  95. package/src/lib/grid-view/grid-view.component.scss +0 -47
  96. package/src/lib/grid-view/grid-view.component.spec.ts +0 -23
  97. package/src/lib/grid-view/grid-view.component.ts +0 -292
  98. package/src/lib/input-area/input-area.component.html +0 -30
  99. package/src/lib/input-area/input-area.component.scss +0 -68
  100. package/src/lib/input-area/input-area.component.spec.ts +0 -23
  101. package/src/lib/input-area/input-area.component.ts +0 -69
  102. package/src/lib/input-arquivo/input-arquivo.component.html +0 -11
  103. package/src/lib/input-arquivo/input-arquivo.component.scss +0 -0
  104. package/src/lib/input-arquivo/input-arquivo.component.spec.ts +0 -23
  105. package/src/lib/input-arquivo/input-arquivo.component.ts +0 -140
  106. package/src/lib/input-cep/input-cep.component.html +0 -38
  107. package/src/lib/input-cep/input-cep.component.scss +0 -0
  108. package/src/lib/input-cep/input-cep.component.spec.ts +0 -23
  109. package/src/lib/input-cep/input-cep.component.ts +0 -186
  110. package/src/lib/input-checkbox/input-checkbox.component.html +0 -12
  111. package/src/lib/input-checkbox/input-checkbox.component.scss +0 -11
  112. package/src/lib/input-checkbox/input-checkbox.component.spec.ts +0 -23
  113. package/src/lib/input-checkbox/input-checkbox.component.ts +0 -48
  114. package/src/lib/input-format/input-format.component.html +0 -32
  115. package/src/lib/input-format/input-format.component.scss +0 -47
  116. package/src/lib/input-format/input-format.component.spec.ts +0 -23
  117. package/src/lib/input-format/input-format.component.ts +0 -139
  118. package/src/lib/input-pesquisa/input-pesquisa.component.html +0 -77
  119. package/src/lib/input-pesquisa/input-pesquisa.component.scss +0 -127
  120. package/src/lib/input-pesquisa/input-pesquisa.component.spec.ts +0 -23
  121. package/src/lib/input-pesquisa/input-pesquisa.component.ts +0 -558
  122. package/src/lib/input-radio/input-radio.component.html +0 -21
  123. package/src/lib/input-radio/input-radio.component.scss +0 -3
  124. package/src/lib/input-radio/input-radio.component.spec.ts +0 -23
  125. package/src/lib/input-radio/input-radio.component.ts +0 -49
  126. package/src/lib/input-select/input-select.component.html +0 -29
  127. package/src/lib/input-select/input-select.component.scss +0 -62
  128. package/src/lib/input-select/input-select.component.spec.ts +0 -23
  129. package/src/lib/input-select/input-select.component.ts +0 -96
  130. package/src/lib/input-text/input-text.component.html +0 -48
  131. package/src/lib/input-text/input-text.component.scss +0 -63
  132. package/src/lib/input-text/input-text.component.spec.ts +0 -23
  133. package/src/lib/input-text/input-text.component.ts +0 -78
  134. package/src/lib/input-valor/input-valor.component.html +0 -32
  135. package/src/lib/input-valor/input-valor.component.scss +0 -47
  136. package/src/lib/input-valor/input-valor.component.spec.ts +0 -23
  137. package/src/lib/input-valor/input-valor.component.ts +0 -164
  138. package/src/lib/model-treeview/model-treeview.component.html +0 -20
  139. package/src/lib/model-treeview/model-treeview.component.scss +0 -0
  140. package/src/lib/model-treeview/model-treeview.component.spec.ts +0 -23
  141. package/src/lib/model-treeview/model-treeview.component.ts +0 -152
  142. package/src/lib/tree-view/tree-view.component.html +0 -96
  143. package/src/lib/tree-view/tree-view.component.scss +0 -50
  144. package/src/lib/tree-view/tree-view.component.spec.ts +0 -23
  145. package/src/lib/tree-view/tree-view.component.ts +0 -92
  146. package/src/lib/tree-view-nivel/tree-view-nivel.component.html +0 -17
  147. package/src/lib/tree-view-nivel/tree-view-nivel.component.scss +0 -8
  148. package/src/lib/tree-view-nivel/tree-view-nivel.component.spec.ts +0 -23
  149. package/src/lib/tree-view-nivel/tree-view-nivel.component.ts +0 -43
  150. package/src/test.ts +0 -15
  151. package/tsconfig.lib.json +0 -15
  152. package/tsconfig.lib.prod.json +0 -10
  153. package/tsconfig.spec.json +0 -17
@@ -1,140 +0,0 @@
1
- import { Component, Input, OnInit, ViewChild, ElementRef, EventEmitter, Output } from '@angular/core';
2
- import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
3
- import { Subject } from 'rxjs';
4
-
5
- @Component({
6
- selector: 'kb-input-arquivo',
7
- templateUrl: './input-arquivo.component.html',
8
- styleUrls: ['./input-arquivo.component.scss'],
9
- providers: [{
10
- provide: NG_VALUE_ACCESSOR,
11
- useExisting: InputArquivoComponent,
12
- multi: true
13
- }]
14
- })
15
- export class InputArquivoComponent implements OnInit, ControlValueAccessor {
16
- @Input() nomeArquivo: string;
17
-
18
- //@Input() disabled: boolean = false;
19
-
20
- @Input() caption: string;
21
- @Input() pasta: string;
22
- @Input() subir: boolean = false;
23
- @Input() callback = new EventEmitter();
24
- @Input() tipoArquivo: string = "image/*";
25
- @Output() fileSelected = new EventEmitter();
26
- @Input() form: boolean = false;
27
- @Input() showIcon: boolean = false;
28
- @Input() icon: string;
29
- @Input() iconSrc: string; ///assets/icon/image_primary_24dp.svg
30
- @Input() btnExpand: string = "block";
31
- @Input() btnColor: string = "primary";
32
- @Input() btnFill: string = "outline";
33
- @Input() iconSlot: string = "start";
34
- @Input() arquivoTipos: string = "image/*";
35
- @Input() readOnly: boolean = false;
36
-
37
- //imagem
38
- @ViewChild('inputNome', { read: ElementRef, static: true }) myInput;
39
- captureDataUrl: string;
40
- public formFile: any;
41
- public sucessoEvent: Subject<boolean> = new Subject();
42
-
43
- data: string;
44
- filename: string;
45
-
46
- private onChange: Function = (selectedColor: string) => { };
47
- private onTouch: Function = () => { };
48
- private disabled: boolean = false;
49
-
50
- showImageBrowser() {
51
- this.myInput.nativeElement.click();
52
- }
53
-
54
- writeValue(value: string): void {
55
- this.onChange(value);
56
- this.data = value;
57
- if (this.callback)
58
- this.callback.emit(this.filename);
59
- }
60
- registerOnChange(fn: any): void {
61
- this.onChange = fn;
62
- }
63
- registerOnTouched(fn: any): void {
64
- this.onTouch = fn;
65
- }
66
- setDisabledState?(isDisabled: boolean): void {
67
- this.disabled = this.disabled;
68
- }
69
-
70
- constructor() {
71
-
72
- }
73
-
74
- ngOnInit(): void {
75
-
76
- }
77
-
78
- loadImagem() {
79
- //console.log(this.myInput);
80
- this.formFile = this.myInput.nativeElement.files[0];
81
-
82
- if (this.fileSelected) {
83
- this.fileSelected.emit({ content: this.formFile, name: this.myInput.nativeElement.files[0].name });
84
- }
85
-
86
- if (this.form) {
87
- //this.formFile = this.myInput.nativeElement.files[0];
88
- this.sucessoEvent.next(true);
89
-
90
- } else {
91
- //this.formFile = this.myInput.nativeElement.files[0];
92
- this.getBase64FromFile(this.myInput.nativeElement.files[0])
93
- .then(result => {
94
- //console.log('file: ', result.toString());
95
- //console.log('nome do arquivo: ', this.nomeArquivo.toLowerCase());
96
- let searchstr = result.toString().substring(0, result.toString().indexOf('base64,')) + 'base64,';
97
- console.log('searchstring', searchstr);
98
- if (this.subir) {
99
- this.captureDataUrl = result.toString().replace(searchstr, '');
100
- } else {
101
- this.captureDataUrl = result.toString();
102
- }
103
- //this.utils.showToast('Imagem carregada em memória.');
104
- this.sucessoEvent.next(true);
105
- console.log('file', this.myInput.nativeElement.files[0]);
106
- this.filename = this.myInput.nativeElement.files[0].name;
107
- this.writeValue(this.captureDataUrl);
108
-
109
-
110
-
111
- // if (this.nomeArquivo && this.subir) {
112
- // this.arquivoService.setImagem({ Nome: this.nomeArquivo, Conteudo: this.captureDataUrl, Status: 0, Pasta: this.pasta })
113
- // .subscribe(result => {
114
- // console.log('result set imagem', result);
115
- // if (result.Status == 200) {
116
- // this.utils.showToast('Sucesso!');
117
- // } else {
118
- // this.utils.showAlert('Erro. Tente mais tarde.' + result.Conteudo);
119
- // }
120
- // }, error => {
121
- // this.utils.showAlert('Erro. Tente mais tarde.');
122
- // })
123
- // }
124
-
125
- }).catch(error => {
126
- this.sucessoEvent.next(false);
127
- })
128
- }
129
- }
130
-
131
- //util
132
- getBase64FromFile(file: File) {
133
- return new Promise((resolve, reject) => {
134
- const reader = new FileReader();
135
- reader.readAsDataURL(file);
136
- reader.onload = () => resolve(reader.result);
137
- reader.onerror = error => reject(error);
138
- });
139
- }
140
- }
@@ -1,38 +0,0 @@
1
- <!--
2
- <div [formGroup]="form">
3
- -->
4
- <!--comando --inner-padding-end: utilizado pra remover padding desnecessários-->
5
- <div>
6
- <ion-item lines="none" style="--background: inherited;--background-focused: transparent;--inner-padding-end: 0px;" [class]="itemClass"
7
- [ngClass]="form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' "
8
- >
9
- <ion-label [position]="labelPosition">{{ label }}</ion-label>
10
- <!-- formControlName={{formControlName}} -->
11
- <ion-input #inputCep
12
- type="tel"
13
- [placeholder]="placeholder"
14
- maxlength="{{ max }}"
15
- (keydown)="digitarFormatado($event)"
16
- (keyup.enter)="onKeyEnter()"
17
- (ionBlur)="onBlur()"
18
- [value]="data"
19
- (input)="writeValue(inputCep.value)"
20
- [disabled]="readonly"></ion-input>
21
-
22
- <ion-button size="small" slot="end" tabindex="-1"
23
- style="margin-top: 25px; margin-inline-start: 4px !important; --padding-start:2px; --padding-end: 2px;" fill="clear" color="medium"
24
- (click)="pesquisarClick()">
25
- <ion-icon color="primary" name="search"></ion-icon>
26
- </ion-button>
27
-
28
- </ion-item>
29
-
30
- <div class="validation-errors" *ngIf="form">
31
- <ng-container *ngFor="let validation of validation_messages">
32
- <div class="error-message"
33
- *ngIf="form && form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)">
34
- &#8226; {{ validation.message }}
35
- </div>
36
- </ng-container>
37
- </div>
38
- </div>
File without changes
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { InputCepComponent } from './input-cep.component';
4
-
5
- describe('InputCepComponent', () => {
6
- let component: InputCepComponent;
7
- let fixture: ComponentFixture<InputCepComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ InputCepComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(InputCepComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,186 +0,0 @@
1
- import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2
- import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
3
- import { Observable } from 'rxjs';
4
- import { BaseInputComponent } from '../baseInputComponent';
5
-
6
- @Component({
7
- selector: 'kb-input-cep',
8
- templateUrl: './input-cep.component.html',
9
- styleUrls: ['./input-cep.component.scss', './../baseComponent.scss'],
10
- providers: [{
11
- provide: NG_VALUE_ACCESSOR,
12
- useExisting: InputCepComponent,
13
- multi: true
14
- }]
15
- })
16
- export class InputCepComponent extends BaseInputComponent implements OnInit, ControlValueAccessor {
17
-
18
- @Input() formato: string | null = '00000-000';
19
- @Input() keyEnter: Function | null = null;
20
- @Output() getResultados = new EventEmitter();
21
-
22
- //control value acessor
23
- public data: string | any = null;
24
- private onChange: Function = (data: string) => { };
25
- private onTouch: Function = () => { };
26
- private disabled: boolean = false;
27
- constructor() {
28
- super();
29
- }
30
-
31
- writeValue(value: string | any): void {
32
- //console.log('write value', value);
33
- this.onChange(value);
34
- this.data = value;
35
- }
36
- registerOnChange(fn: any): void {
37
- this.onChange = fn;
38
- }
39
- registerOnTouched(fn: any): void {
40
- this.onTouch = fn;
41
- }
42
- setDisabledState?(isDisabled: boolean): void {
43
- this.disabled = this.disabled;
44
- }
45
-
46
- override ngOnInit(): void {
47
- }
48
-
49
- digitarFormatado(event: any) {
50
- //console.log(event);
51
- if ((event.keyCode >= 48 && event.keyCode <= 57)
52
- || (event.keyCode >= 96 && event.keyCode <= 105)
53
- || (event.keyCode == 8)
54
- || (event.keyCode == 9)
55
- || (event.keyCode == 39)
56
- || (event.keyCode == 37)
57
- || (event.keyCode == 46)) {
58
-
59
- //console.log(this.formControlName, this.form.get(this.formControlName).value);
60
-
61
- setTimeout(() => {
62
- if (this.form) {
63
- this.form.patchValue({
64
- [this.formControlName]: this.formataCampoValor(this.form.get(this.formControlName)?.value, this.formato ?? '', event)
65
- });
66
- } else {
67
- this.data = this.formataCampoValor(this.data ?? '', this.formato ?? '', event);
68
- this.writeValue(this.data);
69
- }
70
- }, 100);
71
-
72
- return true;
73
- }
74
- else {
75
- return false;
76
- }
77
- }
78
-
79
- onKeyEnter() {
80
- if (this.keyEnter != null) {
81
- this.keyEnter();
82
- } else {
83
- if (this.getResultados != null) {
84
- this.pesquisarClick();
85
- }
86
- }
87
- }
88
-
89
- onBlur() {
90
- if (this.form) {
91
- this.form.get(this.formControlName)?.markAsTouched();
92
- }
93
- if (this.blur) {
94
- this.blur.emit(this.blurArgs);
95
- }
96
- }
97
-
98
- formataCampoValor(valor: string, Mascara: string, evento: any) {
99
- //console.log(valor);
100
- if (!valor)
101
- return null;
102
- //console.log(evento);
103
-
104
- //if (!this.keypressInteiro(evento))
105
- // return;
106
-
107
- var boleanoMascara;
108
-
109
- var Digitato = evento != null ? evento.keyCode : 0;
110
- let exp = /\-|\.|\/|\(|\)| /g
111
- let campoSoNumeros = valor.replace(exp, "");
112
-
113
- var posicaoCampo = 0;
114
- var NovoValorCampo = "";
115
- var TamanhoMascara = campoSoNumeros.length;;
116
-
117
- if (Digitato != 8) { // backspace
118
- for (let i = 0; i <= TamanhoMascara; i++) {
119
- boleanoMascara = ((Mascara.charAt(i) == "-") || (Mascara.charAt(i) == ".")
120
- || (Mascara.charAt(i) == "/"))
121
- boleanoMascara = boleanoMascara || ((Mascara.charAt(i) == "(")
122
- || (Mascara.charAt(i) == ")") || (Mascara.charAt(i) == " "))
123
- if (boleanoMascara) {
124
- NovoValorCampo += Mascara.charAt(i);
125
- TamanhoMascara++;
126
- } else {
127
- NovoValorCampo += campoSoNumeros.charAt(posicaoCampo);
128
- posicaoCampo++;
129
- }
130
- }
131
- return NovoValorCampo;
132
- } else {
133
- return valor;
134
- }
135
- }
136
-
137
- pesquisarClick() {
138
- const cep = this.data;
139
- //se não estiver informado o cep, não fazer a pesquisa
140
- if (cep == null || cep == "") {
141
- return;
142
- }
143
-
144
- this.getEnderecoPeloCep(cep).subscribe({
145
- next: (result) => {
146
- //console.log('result CEP', result);
147
-
148
- let cidadePesquisa: string = result.localidade;
149
- cidadePesquisa = this.converteCaracteresEspeciais(cidadePesquisa.toUpperCase());
150
-
151
- if (this.getResultados) {
152
- this.getResultados.emit(result);
153
- }
154
-
155
- }, error: (error) => {
156
-
157
- }
158
- });
159
- }
160
-
161
- //substituição de caracteres
162
- converteCaracteresEspeciais(nome: string): string {
163
- var res = nome.replace(/Ã/g, "A");
164
- res = res.replace(/Á/g, "A");
165
- res = res.replace(/Ç/g, "C");
166
- res = res.replace(/É/g, "E");
167
- res = res.replace(/Â/g, "A");
168
- res = res.replace(/Ô/g, "O");
169
- res = res.replace(/Ó/g, "O");
170
- res = res.replace(/Ú/g, "U");
171
- res = res.replace(/Í/g, "I");
172
- return res;
173
- }
174
-
175
- getEnderecoPeloCep(cep: any): Observable<any> {
176
- return new Observable((x) => {
177
- var request = new XMLHttpRequest();
178
- request.open('get', `https://viacep.com.br/ws/${cep}/json/`, true);
179
- request.send();
180
- request.onload = function () {
181
- var data = JSON.parse(this.response);
182
- x.next(data)
183
- }
184
- })
185
- }
186
- }
@@ -1,12 +0,0 @@
1
- <div>
2
- <ion-item lines="none" style="--background: inherited; --background-focused: transparent; padding-right: 0px;" [class]="itemClass">
3
- <ion-checkbox #inputCheck
4
- [labelPlacement]="labelPlacement" [justify]="justify"
5
- [disabled]="readonly"
6
- [checked]="data"
7
- [color]="labelColor ?? 'primary'"
8
- (ionChange)="writeValue(inputCheck.checked)">
9
- <span [style.color]="labelColor ?? 'auto'">{{ label }}</span>
10
- </ion-checkbox>
11
- </ion-item>
12
- </div>
@@ -1,11 +0,0 @@
1
- ion-item {
2
- --min-height: var(--checkbox-min-height, 48px) !important;
3
- }
4
-
5
- ion-checkbox.checkbox-disabled {
6
- opacity: var(--item-disabled-opacity, 0.6) !important;
7
- }
8
-
9
- span {
10
- color: var(--checkbox-text-color, 'inherit') !important;
11
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { InputCheckboxComponent } from './input-checkbox.component';
4
-
5
- describe('InputCheckboxComponent', () => {
6
- let component: InputCheckboxComponent;
7
- let fixture: ComponentFixture<InputCheckboxComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [InputCheckboxComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(InputCheckboxComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,48 +0,0 @@
1
- import { Component, Input, OnInit } from '@angular/core';
2
- import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
3
- import { BaseInputComponent } from '../baseInputComponent';
4
-
5
- @Component({
6
- selector: 'kb-input-checkbox',
7
- templateUrl: './input-checkbox.component.html',
8
- styleUrls: ['./input-checkbox.component.scss', './../baseComponent.scss'],
9
- providers: [{
10
- provide: NG_VALUE_ACCESSOR,
11
- useExisting: InputCheckboxComponent,
12
- multi: true
13
- }]
14
- })
15
- export class InputCheckboxComponent extends BaseInputComponent implements OnInit, ControlValueAccessor {
16
-
17
- @Input() justify: string = "start";
18
- @Input() labelPlacement: string = "end";
19
- //control value acessor
20
- public data!: boolean | undefined;
21
- private onChange: Function = (data: string) => { };
22
- private onTouch: Function = () => { };
23
- private disabled: boolean = false;
24
- public console = console;
25
-
26
- writeValue(value?: any): void {
27
- console.log('write value', value);
28
- this.onChange(value);
29
- this.data = value;
30
- }
31
- registerOnChange(fn: any): void {
32
- this.onChange = fn;
33
- }
34
- registerOnTouched(fn: any): void {
35
- this.onTouch = fn;
36
- }
37
- setDisabledState?(isDisabled: boolean): void {
38
- this.disabled = this.disabled;
39
- }
40
- constructor() {
41
- super();
42
- }
43
-
44
-
45
-
46
- override ngOnInit(): void {
47
- }
48
- }
@@ -1,32 +0,0 @@
1
- <!--
2
- <div [formGroup]="form">
3
- -->
4
- <!--comando --inner-padding-end: utilizado pra remover padding desnecessários-->
5
- <div>
6
- <ion-item lines="none" style="--background: inherited;--background-focused: transparent;--inner-padding-end: 0px;" [class]="itemClass"
7
- [ngClass]="form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' "
8
- >
9
- <ion-label [position]="labelPosition">{{ label }}</ion-label>
10
- <!-- formControlName={{formControlName}} -->
11
- <ion-input #inputFormat
12
- type="tel"
13
- [placeholder]="placeholder"
14
- maxlength="{{ max }}"
15
- (keydown)="digitarFormatado($event)"
16
- (keyup.enter)="onKeyEnter()"
17
- (ionBlur)="onBlur()"
18
- [value]="data"
19
- (input)="writeValue(inputFormat.value)"
20
- [disabled]="readonly"></ion-input>
21
-
22
- </ion-item>
23
-
24
- <div class="validation-errors" *ngIf="form">
25
- <ng-container *ngFor="let validation of validation_messages">
26
- <div class="error-message"
27
- *ngIf="form && form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)">
28
- &#8226; {{ validation.message }}
29
- </div>
30
- </ng-container>
31
- </div>
32
- </div>
@@ -1,47 +0,0 @@
1
- /*
2
- @keyframes shake {
3
- 0% { transform: translate(20px); }
4
- 20% { transform: translate(-20px); }
5
- 40% { transform: translate(10px); }
6
- 60% { transform: translate(-10px); }
7
- 80% { transform: translate(4px); }
8
- 100% { transform: translate(0px); }
9
- }
10
- .error-shake {
11
- ion-label {
12
- color: red !important;
13
- }
14
- ion-input {
15
- animation: shake 0.4s 1 linear;
16
- border: 1px solid red !important;
17
- }
18
- }
19
- */
20
-
21
- /*
22
- .has-focus {
23
- border: 1px solid var(--ion-color-bluetool, #1f477d);
24
- }
25
- */
26
-
27
- /*
28
- ion-label {
29
- margin-bottom: 4px !important;
30
- }
31
- */
32
-
33
- /*
34
- ion-input {
35
- padding: 4px;
36
- border: 1px solid darkgray;
37
- border-radius: 4px;
38
- width: 100%;
39
- margin-top: 2px;
40
- max-height: 29px;
41
- }
42
- */
43
-
44
-
45
- .item-inner {
46
- padding-right: 0px !important;
47
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { InputFormatComponent } from './input-format.component';
4
-
5
- describe('InputFormatComponent', () => {
6
- let component: InputFormatComponent;
7
- let fixture: ComponentFixture<InputFormatComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ InputFormatComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(InputFormatComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });