appproject-components 0.0.31 → 1.0.1

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 (46) hide show
  1. package/{esm2020 → esm2022}/appproject-components.mjs +4 -4
  2. package/{esm2020 → esm2022}/lib/appproject-components.component.mjs +15 -15
  3. package/{esm2020 → esm2022}/lib/appproject-components.module.mjs +96 -96
  4. package/{esm2020 → esm2022}/lib/appproject-components.service.mjs +14 -14
  5. package/esm2022/lib/baseInputComponent.mjs +66 -0
  6. package/esm2022/lib/input-area/input-area.component.mjs +53 -0
  7. package/esm2022/lib/input-arquivo/input-arquivo.component.mjs +122 -0
  8. package/esm2022/lib/input-cep/input-cep.component.mjs +180 -0
  9. package/esm2022/lib/input-format/input-format.component.mjs +138 -0
  10. package/esm2022/lib/input-pesquisa/input-pesquisa.component.mjs +549 -0
  11. package/esm2022/lib/input-select/input-select.component.mjs +88 -0
  12. package/esm2022/lib/input-text/input-text.component.mjs +76 -0
  13. package/esm2022/lib/input-valor/input-valor.component.mjs +158 -0
  14. package/{esm2020 → esm2022}/lib/model-treeview/model-treeview.component.mjs +14 -14
  15. package/{esm2020 → esm2022}/public-api.mjs +18 -18
  16. package/fesm2022/appproject-components.mjs +1519 -0
  17. package/fesm2022/appproject-components.mjs.map +1 -0
  18. package/index.d.ts +5 -5
  19. package/lib/appproject-components.component.d.ts +8 -8
  20. package/lib/appproject-components.module.d.ts +26 -26
  21. package/lib/appproject-components.service.d.ts +6 -6
  22. package/lib/baseInputComponent.d.ts +27 -27
  23. package/lib/input-area/input-area.component.d.ts +21 -21
  24. package/lib/input-arquivo/input-arquivo.component.d.ts +33 -34
  25. package/lib/input-cep/input-cep.component.d.ts +29 -29
  26. package/lib/input-format/input-format.component.d.ts +27 -25
  27. package/lib/input-pesquisa/input-pesquisa.component.d.ts +68 -68
  28. package/lib/input-select/input-select.component.d.ts +29 -28
  29. package/lib/input-text/input-text.component.d.ts +29 -25
  30. package/lib/input-valor/input-valor.component.d.ts +28 -25
  31. package/lib/model-treeview/model-treeview.component.d.ts +8 -8
  32. package/package.json +8 -14
  33. package/public-api.d.ts +13 -13
  34. package/esm2020/lib/baseInputComponent.mjs +0 -65
  35. package/esm2020/lib/input-area/input-area.component.mjs +0 -53
  36. package/esm2020/lib/input-arquivo/input-arquivo.component.mjs +0 -114
  37. package/esm2020/lib/input-cep/input-cep.component.mjs +0 -180
  38. package/esm2020/lib/input-format/input-format.component.mjs +0 -129
  39. package/esm2020/lib/input-pesquisa/input-pesquisa.component.mjs +0 -540
  40. package/esm2020/lib/input-select/input-select.component.mjs +0 -80
  41. package/esm2020/lib/input-text/input-text.component.mjs +0 -65
  42. package/esm2020/lib/input-valor/input-valor.component.mjs +0 -125
  43. package/fesm2015/appproject-components.mjs +0 -1456
  44. package/fesm2015/appproject-components.mjs.map +0 -1
  45. package/fesm2020/appproject-components.mjs +0 -1441
  46. package/fesm2020/appproject-components.mjs.map +0 -1
@@ -0,0 +1,1519 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, EventEmitter, Input, Output, ElementRef, ViewChild, Inject, InjectionToken, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
+ import * as i3 from '@angular/forms';
4
+ import { NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
5
+ import * as i1 from '@angular/common';
6
+ import { CommonModule } from '@angular/common';
7
+ import * as i2 from '@ionic/angular';
8
+ import { IonicModule } from '@ionic/angular';
9
+ import * as i1$1 from '@angular/common/http';
10
+ import { HttpClientModule } from '@angular/common/http';
11
+ import { Subject, of, Observable } from 'rxjs';
12
+ import { debounceTime, switchMap } from 'rxjs/operators';
13
+
14
+ class AppprojectComponentsService {
15
+ constructor() { }
16
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
17
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsService, providedIn: 'root' }); }
18
+ }
19
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsService, decorators: [{
20
+ type: Injectable,
21
+ args: [{
22
+ providedIn: 'root'
23
+ }]
24
+ }], ctorParameters: () => [] });
25
+
26
+ class AppprojectComponentsComponent {
27
+ constructor() { }
28
+ ngOnInit() {
29
+ }
30
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
31
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: AppprojectComponentsComponent, selector: "kb-appproject-components", ngImport: i0, template: `
32
+ <p>
33
+ appproject-components works!
34
+ </p>
35
+ `, isInline: true }); }
36
+ }
37
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsComponent, decorators: [{
38
+ type: Component,
39
+ args: [{ selector: 'kb-appproject-components', template: `
40
+ <p>
41
+ appproject-components works!
42
+ </p>
43
+ ` }]
44
+ }], ctorParameters: () => [] });
45
+
46
+ class BaseInputComponent {
47
+ constructor() {
48
+ this.labelPosition = 'stacked';
49
+ this.placeholder = '';
50
+ this.max = '10';
51
+ this.type = "text";
52
+ this.readonly = false;
53
+ this.leitura = false;
54
+ this.itemClass = "padding";
55
+ this.blur = new EventEmitter();
56
+ this.botaoLimpar = false;
57
+ this.labelColor = 'dark';
58
+ this.inputBackgroungColor = 'auto';
59
+ }
60
+ ngOnInit() {
61
+ throw new Error('Method not implemented.');
62
+ }
63
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: BaseInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
64
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: BaseInputComponent, selector: "ng-component", inputs: { label: "label", labelPosition: "labelPosition", nome: "nome", placeholder: "placeholder", form: "form", campo: "campo", formControlName: "formControlName", max: "max", validation_messages: "validation_messages", type: "type", readonly: "readonly", leitura: "leitura", itemClass: "itemClass", botaoLimpar: "botaoLimpar", labelColor: "labelColor", inputBackgroungColor: "inputBackgroungColor", blurArgs: "blurArgs" }, outputs: { blur: "blur" }, ngImport: i0, template: '', isInline: true }); }
65
+ }
66
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: BaseInputComponent, decorators: [{
67
+ type: Component,
68
+ args: [{
69
+ template: ''
70
+ }]
71
+ }], ctorParameters: () => [], propDecorators: { label: [{
72
+ type: Input
73
+ }], labelPosition: [{
74
+ type: Input
75
+ }], nome: [{
76
+ type: Input
77
+ }], placeholder: [{
78
+ type: Input
79
+ }], form: [{
80
+ type: Input
81
+ }], campo: [{
82
+ type: Input
83
+ }], formControlName: [{
84
+ type: Input,
85
+ args: ['formControlName']
86
+ }], max: [{
87
+ type: Input
88
+ }], validation_messages: [{
89
+ type: Input
90
+ }], type: [{
91
+ type: Input
92
+ }], readonly: [{
93
+ type: Input
94
+ }], leitura: [{
95
+ type: Input
96
+ }], itemClass: [{
97
+ type: Input
98
+ }], blur: [{
99
+ type: Output
100
+ }], botaoLimpar: [{
101
+ type: Input
102
+ }], labelColor: [{
103
+ type: Input
104
+ }], inputBackgroungColor: [{
105
+ type: Input
106
+ }], blurArgs: [{
107
+ type: Input
108
+ }] } });
109
+
110
+ class InputTextComponent extends BaseInputComponent {
111
+ writeValue(value) {
112
+ //console.log('write value', value);
113
+ this.onChange(value);
114
+ this.data = value;
115
+ }
116
+ registerOnChange(fn) {
117
+ this.onChange = fn;
118
+ }
119
+ registerOnTouched(fn) {
120
+ this.onTouch = fn;
121
+ }
122
+ setDisabledState(isDisabled) {
123
+ this.disabled = this.disabled;
124
+ }
125
+ constructor() {
126
+ super();
127
+ this.inputSpanAfter = null;
128
+ this.onChange = (data) => { };
129
+ this.onTouch = () => { };
130
+ this.disabled = false;
131
+ this.console = console;
132
+ }
133
+ ngOnInit() {
134
+ }
135
+ onBlur() {
136
+ console.log('control name', this.formControlName);
137
+ if (this.form) {
138
+ this.form.get(this.formControlName)?.markAsTouched();
139
+ }
140
+ }
141
+ limparClick() {
142
+ this.writeValue(undefined);
143
+ }
144
+ isReadonly() {
145
+ return this.leitura;
146
+ }
147
+ changeTypeOfInput() {
148
+ this.type =
149
+ this.type == 'password' ?
150
+ 'text' : 'password';
151
+ }
152
+ setFocus() {
153
+ this.inputTextEdit.nativeElement.setFocus();
154
+ }
155
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
156
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: InputTextComponent, selector: "kb-input-text", inputs: { iconInput: "iconInput", inputSpanAfter: "inputSpanAfter", campoFoco: "campoFoco" }, providers: [{
157
+ provide: NG_VALUE_ACCESSOR,
158
+ useExisting: InputTextComponent,
159
+ multi: true
160
+ }], viewQueries: [{ propertyName: "inputTextEdit", first: true, predicate: ["inputText"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<!--\r\n<div [formGroup]=\"form\">\r\n-->\r\n<div>\r\n <ion-item lines=\"none\" style=\"--background: inherited; --background-focused: transparent; padding-right: 0px;\" [class]=\"itemClass\"\r\n [style.opacity]=\"readonly ? '0.5' : '1'\"\r\n [ngClass]=\"form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' \"\r\n >\r\n <ion-label position=\"{{ labelPosition }}\" color=\"{{ labelColor }}\">{{ label }}</ion-label>\r\n <!-- formControlName=\"{{ campo }}\" -->\r\n <ion-input #inputText\r\n type=\"{{type}}\" \r\n [placeholder]=\"placeholder\" \r\n maxlength=\"{{ max }}\"\r\n (ionBlur)=\"onBlur()\"\r\n [value]=\"data\"\r\n (input)=\"writeValue(inputText.value)\" \r\n autocomplete=\"new-password\"\r\n [style.--background]=\"inputBackgroungColor\"\r\n [disabled]=\"readonly\"\r\n [clearInput]=\"botaoLimpar\">\r\n <ion-icon *ngIf=\"iconInput\" name=\"{{ iconInput }}\"></ion-icon>\r\n </ion-input>\r\n \r\n <ion-button size=\"small\" slot=\"end\" *ngIf=\"showSeePassword\" style=\"margin-top: 27px; margin-inline-start: 4px !important;\" fill=\"clear\" color=\"dark\" (click)=\"changeTypeOfInput()\">\r\n <!-- (click)=\"limparClick()\" -->\r\n <ion-icon [name]=\"type == 'password' ? 'eye-outline' : 'eye-off-outline' \"></ion-icon>\r\n </ion-button>\r\n\r\n <span *ngIf=\"inputSpanAfter\" slot=\"end\" class=\"inputSpanAfter-item\">&nbsp;{{ inputSpanAfter }}</span>\r\n </ion-item>\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n \r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n \r\n </div>\r\n </div>", styles: [".no-padding-end{--inner-padding-end: 0}ion-input ion-icon{padding-right:6px;font-size:18px}.input-login{height:36px}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "legacy", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "directive", type: i2.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }] }); }
161
+ }
162
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputTextComponent, decorators: [{
163
+ type: Component,
164
+ args: [{ selector: 'kb-input-text', providers: [{
165
+ provide: NG_VALUE_ACCESSOR,
166
+ useExisting: InputTextComponent,
167
+ multi: true
168
+ }], template: "<!--\r\n<div [formGroup]=\"form\">\r\n-->\r\n<div>\r\n <ion-item lines=\"none\" style=\"--background: inherited; --background-focused: transparent; padding-right: 0px;\" [class]=\"itemClass\"\r\n [style.opacity]=\"readonly ? '0.5' : '1'\"\r\n [ngClass]=\"form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' \"\r\n >\r\n <ion-label position=\"{{ labelPosition }}\" color=\"{{ labelColor }}\">{{ label }}</ion-label>\r\n <!-- formControlName=\"{{ campo }}\" -->\r\n <ion-input #inputText\r\n type=\"{{type}}\" \r\n [placeholder]=\"placeholder\" \r\n maxlength=\"{{ max }}\"\r\n (ionBlur)=\"onBlur()\"\r\n [value]=\"data\"\r\n (input)=\"writeValue(inputText.value)\" \r\n autocomplete=\"new-password\"\r\n [style.--background]=\"inputBackgroungColor\"\r\n [disabled]=\"readonly\"\r\n [clearInput]=\"botaoLimpar\">\r\n <ion-icon *ngIf=\"iconInput\" name=\"{{ iconInput }}\"></ion-icon>\r\n </ion-input>\r\n \r\n <ion-button size=\"small\" slot=\"end\" *ngIf=\"showSeePassword\" style=\"margin-top: 27px; margin-inline-start: 4px !important;\" fill=\"clear\" color=\"dark\" (click)=\"changeTypeOfInput()\">\r\n <!-- (click)=\"limparClick()\" -->\r\n <ion-icon [name]=\"type == 'password' ? 'eye-outline' : 'eye-off-outline' \"></ion-icon>\r\n </ion-button>\r\n\r\n <span *ngIf=\"inputSpanAfter\" slot=\"end\" class=\"inputSpanAfter-item\">&nbsp;{{ inputSpanAfter }}</span>\r\n </ion-item>\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n \r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n \r\n </div>\r\n </div>", styles: [".no-padding-end{--inner-padding-end: 0}ion-input ion-icon{padding-right:6px;font-size:18px}.input-login{height:36px}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"] }]
169
+ }], ctorParameters: () => [], propDecorators: { iconInput: [{
170
+ type: Input
171
+ }], inputSpanAfter: [{
172
+ type: Input
173
+ }], inputTextEdit: [{
174
+ type: ViewChild,
175
+ args: ['inputText', { read: ElementRef, static: true }]
176
+ }], campoFoco: [{
177
+ type: Input
178
+ }] } });
179
+
180
+ class InputFormatComponent extends BaseInputComponent {
181
+ writeValue(value) {
182
+ //console.log('write value', value);
183
+ this.onChange(value);
184
+ this.data = value;
185
+ }
186
+ registerOnChange(fn) {
187
+ this.onChange = fn;
188
+ }
189
+ registerOnTouched(fn) {
190
+ this.onTouch = fn;
191
+ }
192
+ setDisabledState(isDisabled) {
193
+ this.disabled = this.disabled;
194
+ }
195
+ constructor() {
196
+ super();
197
+ this.formato = null;
198
+ this.keyEnter = new EventEmitter();
199
+ //control value acessor
200
+ this.data = null;
201
+ this.onChange = (data) => { };
202
+ this.onTouch = () => { };
203
+ this.disabled = false;
204
+ this.console = console;
205
+ }
206
+ ngOnInit() { }
207
+ digitarFormatado(event) {
208
+ //console.log(event);
209
+ const index = event.target.selectionStart >= 1 ? (event.target.selectionStart - 1) : 0;
210
+ const keyAt = event.target.value.charCodeAt(index);
211
+ if ((event.keyCode >= 48 && event.keyCode <= 57)
212
+ || (keyAt >= 48 && keyAt <= 57)
213
+ || (event.keyCode >= 96 && event.keyCode <= 105)
214
+ || (event.keyCode == 8)
215
+ || (event.keyCode == 9)
216
+ || (event.keyCode == 39)
217
+ || (event.keyCode == 37)
218
+ || (event.keyCode == 46)) {
219
+ //console.log(this.formControlName, this.form.get(this.formControlName).value);
220
+ setTimeout(() => {
221
+ if (this.form) {
222
+ this.form.patchValue({
223
+ [this.formControlName]: this.formataCampoValor(this.form.get(this.formControlName)?.value, this.formato ?? '', event)
224
+ });
225
+ }
226
+ else {
227
+ this.data = this.formataCampoValor(this.data ?? '', this.formato ?? '', event);
228
+ this.writeValue(this.data);
229
+ }
230
+ }, 100);
231
+ return true;
232
+ }
233
+ else {
234
+ return false;
235
+ }
236
+ }
237
+ onKeyEnter() {
238
+ if (this.keyEnter != null) {
239
+ this.keyEnter.emit();
240
+ }
241
+ }
242
+ onBlur() {
243
+ if (this.form) {
244
+ this.form.get(this.formControlName)?.markAsTouched();
245
+ }
246
+ if (this.blur) {
247
+ this.blur.emit(this.blurArgs);
248
+ }
249
+ }
250
+ setFocus() {
251
+ this.inputFormatEdit.nativeElement.setFocus();
252
+ }
253
+ formataCampoValor(valor, Mascara, evento) {
254
+ console.log(valor);
255
+ if (!valor)
256
+ return null;
257
+ //console.log(evento);
258
+ //if (!this.keypressInteiro(evento))
259
+ // return;
260
+ var boleanoMascara;
261
+ var Digitato = evento != null ? evento.keyCode : 0;
262
+ let exp = /\-|\.|\/|\(|\)| /g;
263
+ let campoSoNumeros = valor.replace(exp, "");
264
+ var posicaoCampo = 0;
265
+ var NovoValorCampo = "";
266
+ var TamanhoMascara = campoSoNumeros.length;
267
+ ;
268
+ if (Digitato != 8) { // backspace
269
+ for (let i = 0; i <= TamanhoMascara; i++) {
270
+ boleanoMascara = ((Mascara.charAt(i) == "-") || (Mascara.charAt(i) == ".")
271
+ || (Mascara.charAt(i) == "/"));
272
+ boleanoMascara = boleanoMascara || ((Mascara.charAt(i) == "(")
273
+ || (Mascara.charAt(i) == ")") || (Mascara.charAt(i) == " "));
274
+ if (boleanoMascara) {
275
+ NovoValorCampo += Mascara.charAt(i);
276
+ TamanhoMascara++;
277
+ }
278
+ else {
279
+ NovoValorCampo += campoSoNumeros.charAt(posicaoCampo);
280
+ posicaoCampo++;
281
+ }
282
+ }
283
+ return NovoValorCampo;
284
+ }
285
+ else {
286
+ return valor;
287
+ }
288
+ }
289
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputFormatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
290
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: InputFormatComponent, selector: "kb-input-format", inputs: { formato: "formato", keyEnter: "keyEnter" }, providers: [{
291
+ provide: NG_VALUE_ACCESSOR,
292
+ useExisting: InputFormatComponent,
293
+ multi: true
294
+ }], viewQueries: [{ propertyName: "inputFormatEdit", first: true, predicate: ["inputFormat"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<!--\r\n<div [formGroup]=\"form\">\r\n-->\r\n<!--comando --inner-padding-end: utilizado pra remover padding desnecess\u00E1rios-->\r\n<div>\r\n <ion-item lines=\"none\" style=\"--background: inherited;--background-focused: transparent;--inner-padding-end: 0px;\" [class]=\"itemClass\"\r\n [ngClass]=\"form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' \"\r\n >\r\n <ion-label [position]=\"labelPosition\">{{ label }}</ion-label>\r\n <!-- formControlName={{formControlName}} -->\r\n <ion-input #inputFormat\r\n type=\"tel\" \r\n [placeholder]=\"placeholder\"\r\n maxlength=\"{{ max }}\" \r\n (keydown)=\"digitarFormatado($event)\" \r\n (keyup.enter)=\"onKeyEnter()\"\r\n (ionBlur)=\"onBlur()\"\r\n [value]=\"data\"\r\n (input)=\"writeValue(inputFormat.value)\"\r\n [disabled]=\"readonly\"></ion-input>\r\n \r\n </ion-item>\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form && form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>", styles: [".item-inner{padding-right:0!important}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "legacy", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "directive", type: i2.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }] }); }
295
+ }
296
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputFormatComponent, decorators: [{
297
+ type: Component,
298
+ args: [{ selector: 'kb-input-format', providers: [{
299
+ provide: NG_VALUE_ACCESSOR,
300
+ useExisting: InputFormatComponent,
301
+ multi: true
302
+ }], template: "<!--\r\n<div [formGroup]=\"form\">\r\n-->\r\n<!--comando --inner-padding-end: utilizado pra remover padding desnecess\u00E1rios-->\r\n<div>\r\n <ion-item lines=\"none\" style=\"--background: inherited;--background-focused: transparent;--inner-padding-end: 0px;\" [class]=\"itemClass\"\r\n [ngClass]=\"form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' \"\r\n >\r\n <ion-label [position]=\"labelPosition\">{{ label }}</ion-label>\r\n <!-- formControlName={{formControlName}} -->\r\n <ion-input #inputFormat\r\n type=\"tel\" \r\n [placeholder]=\"placeholder\"\r\n maxlength=\"{{ max }}\" \r\n (keydown)=\"digitarFormatado($event)\" \r\n (keyup.enter)=\"onKeyEnter()\"\r\n (ionBlur)=\"onBlur()\"\r\n [value]=\"data\"\r\n (input)=\"writeValue(inputFormat.value)\"\r\n [disabled]=\"readonly\"></ion-input>\r\n \r\n </ion-item>\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form && form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>", styles: [".item-inner{padding-right:0!important}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"] }]
303
+ }], ctorParameters: () => [], propDecorators: { formato: [{
304
+ type: Input
305
+ }], keyEnter: [{
306
+ type: Input
307
+ }], inputFormatEdit: [{
308
+ type: ViewChild,
309
+ args: ['inputFormat', { read: ElementRef, static: true }]
310
+ }] } });
311
+
312
+ class InputSelectComponent extends BaseInputComponent {
313
+ writeValue(value) {
314
+ console.log('write value select', value);
315
+ this.onChange(value);
316
+ this.data = value;
317
+ }
318
+ registerOnChange(fn) {
319
+ this.onChange = fn;
320
+ }
321
+ registerOnTouched(fn) {
322
+ this.onTouch = fn;
323
+ }
324
+ setDisabledState(isDisabled) {
325
+ this.disabled = this.disabled;
326
+ }
327
+ constructor() {
328
+ super();
329
+ this.selectChange = new EventEmitter();
330
+ this.selectChangeEntity = new EventEmitter();
331
+ this.itens = [];
332
+ this.itemId = "Id";
333
+ this.itemNome = "Nome";
334
+ this.showNovo = false;
335
+ this.itemNull = true;
336
+ this.opcaoDefault = 'Selecionar';
337
+ this.onChange = (data) => { };
338
+ this.onTouch = () => { };
339
+ this.disabled = false;
340
+ this.console = console;
341
+ }
342
+ ngOnInit() {
343
+ }
344
+ onSelectChange(value) {
345
+ this.writeValue(value);
346
+ if (this.selectChange != null) {
347
+ //console.log('emit', value);
348
+ this.selectChange.emit(value);
349
+ }
350
+ if (this.selectChangeEntity != null) {
351
+ const existe = this.itens.find(i => i[this.itemId] == value);
352
+ this.selectChangeEntity.emit(existe);
353
+ }
354
+ }
355
+ onBlur() {
356
+ //console.log('input select blur')
357
+ if (this.form) {
358
+ this.form.get(this.formControlName)?.markAsTouched();
359
+ }
360
+ }
361
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
362
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: InputSelectComponent, selector: "kb-input-select", inputs: { itens: "itens", itemId: "itemId", itemNome: "itemNome", showNovo: "showNovo", itemNull: "itemNull", opcaoDefault: "opcaoDefault" }, outputs: { selectChange: "selectChange", selectChangeEntity: "selectChangeEntity" }, providers: [{
363
+ provide: NG_VALUE_ACCESSOR,
364
+ useExisting: InputSelectComponent,
365
+ multi: true
366
+ }], usesInheritance: true, ngImport: i0, template: "<!--\r\n<div [formGroup]=\"form\">\r\n-->\r\n<div>\r\n <ion-item lines=\"none\" style=\"--background: inherited; --background-focused: transparent;\" [class]=\"itemClass\"\r\n [ngClass]=\"form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' \"\r\n >\r\n <ion-label *ngIf=\"label\" [position]=\"labelPosition\">{{ label }}</ion-label>\r\n <!-- formControlName=\"{{ formControlName }}\" -->\r\n <select #inputSelect\r\n style=\"width: 100%;\" (change)=\"onSelectChange(inputSelect.value)\"\r\n (blur)=\"onBlur()\" [disabled]=\"readonly\">\r\n <option *ngIf=\"itemNull\" [value]=\"''\" selected>{{ opcaoDefault }}</option>\r\n <option *ngFor=\"let item of itens\" [value]=\"item[itemId]\" [selected]=\"item[itemId] == data\">{{ item[itemNome] }}\r\n </option>\r\n </select> \r\n </ion-item>\r\n \r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form && form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n </div>\r\n \r\n </div>", styles: ["select{padding:var(--select-padding, 4px);border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;height:var(--select-height, 28px);margin-left:0}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:42px!important}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }] }); }
367
+ }
368
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputSelectComponent, decorators: [{
369
+ type: Component,
370
+ args: [{ selector: 'kb-input-select', providers: [{
371
+ provide: NG_VALUE_ACCESSOR,
372
+ useExisting: InputSelectComponent,
373
+ multi: true
374
+ }], template: "<!--\r\n<div [formGroup]=\"form\">\r\n-->\r\n<div>\r\n <ion-item lines=\"none\" style=\"--background: inherited; --background-focused: transparent;\" [class]=\"itemClass\"\r\n [ngClass]=\"form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' \"\r\n >\r\n <ion-label *ngIf=\"label\" [position]=\"labelPosition\">{{ label }}</ion-label>\r\n <!-- formControlName=\"{{ formControlName }}\" -->\r\n <select #inputSelect\r\n style=\"width: 100%;\" (change)=\"onSelectChange(inputSelect.value)\"\r\n (blur)=\"onBlur()\" [disabled]=\"readonly\">\r\n <option *ngIf=\"itemNull\" [value]=\"''\" selected>{{ opcaoDefault }}</option>\r\n <option *ngFor=\"let item of itens\" [value]=\"item[itemId]\" [selected]=\"item[itemId] == data\">{{ item[itemNome] }}\r\n </option>\r\n </select> \r\n </ion-item>\r\n \r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form && form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n </div>\r\n \r\n </div>", styles: ["select{padding:var(--select-padding, 4px);border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;height:var(--select-height, 28px);margin-left:0}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:42px!important}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"] }]
375
+ }], ctorParameters: () => [], propDecorators: { selectChange: [{
376
+ type: Output
377
+ }], selectChangeEntity: [{
378
+ type: Output
379
+ }], itens: [{
380
+ type: Input
381
+ }], itemId: [{
382
+ type: Input
383
+ }], itemNome: [{
384
+ type: Input
385
+ }], showNovo: [{
386
+ type: Input
387
+ }], itemNull: [{
388
+ type: Input
389
+ }], opcaoDefault: [{
390
+ type: Input
391
+ }] } });
392
+
393
+ class ModelTreeviewComponent {
394
+ constructor() { }
395
+ ngOnInit() {
396
+ }
397
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: ModelTreeviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
398
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: ModelTreeviewComponent, selector: "kb-model-treeview", ngImport: i0, template: "<p>model-treeview works!</p>\n", styles: [""] }); }
399
+ }
400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: ModelTreeviewComponent, decorators: [{
401
+ type: Component,
402
+ args: [{ selector: 'kb-model-treeview', template: "<p>model-treeview works!</p>\n" }]
403
+ }], ctorParameters: () => [] });
404
+
405
+ class InputPesquisaComponent extends BaseInputComponent {
406
+ writeValue(value) {
407
+ //console.log('write value', value);
408
+ this.onChange(value);
409
+ this.data = value;
410
+ if (value == null || value == 0) {
411
+ this.writePesquisa('');
412
+ this.selectedItem = null;
413
+ }
414
+ else {
415
+ if (this.loadInit == true) {
416
+ this.loadInit = false;
417
+ this.modelChanged.next(value);
418
+ //this.carregaItemIdParaLista(value);
419
+ }
420
+ else {
421
+ //console.log(this.selectedItem);
422
+ if (!this.selectedItem || (this.selectedItem && this.selectedItem[this.campoId] != value)) {
423
+ console.log('Id diferente');
424
+ this.modelChanged.next(value);
425
+ //this.carregaItemIdParaLista(value);
426
+ }
427
+ }
428
+ }
429
+ }
430
+ registerOnChange(fn) {
431
+ this.onChange = fn;
432
+ }
433
+ registerOnTouched(fn) {
434
+ this.onTouch = fn;
435
+ }
436
+ setDisabledState(isDisabled) {
437
+ this.disabled = this.disabled;
438
+ }
439
+ constructor(config, httpClient, modalCtrl) {
440
+ super();
441
+ this.config = config;
442
+ this.httpClient = httpClient;
443
+ this.modalCtrl = modalCtrl;
444
+ this.podePesquisar = true;
445
+ this.textoPesquisa = '';
446
+ this.selectElementVisivel = false;
447
+ this.listaPesquisa = [];
448
+ this.max = '30';
449
+ this.pesquisaSubject = new Subject();
450
+ this.filterFunction = null;
451
+ this.selectId = 'selectElement';
452
+ this.campoId = 'Id';
453
+ this.campoPaiId = 'PaiId';
454
+ this.campoDisplay = 'Descricao';
455
+ this.tipo = '';
456
+ //@ViewChild('selectElement', { read: ElementRef, static: true }) selectElement;
457
+ this.selectElement = null;
458
+ this.pesquisaChange = new EventEmitter();
459
+ //parametros para chamada API
460
+ //endpoint para pesquisa por digitação
461
+ this.url = '';
462
+ this.urlItem = '';
463
+ //endpoint para montar a arvore, se estiver vazia será usado o campo 'url'
464
+ this.urlTree = '';
465
+ this.empresa = 0;
466
+ this.loadInit = false;
467
+ this.onChange = (data) => { };
468
+ this.onTouch = () => { };
469
+ this.disabled = false;
470
+ this.console = console;
471
+ this.modelChanged = new Subject();
472
+ this.BASE_API = this.config.apiUrl;
473
+ this.modelChangeSubscription = this.modelChanged
474
+ .pipe(debounceTime(500))
475
+ .subscribe(data => {
476
+ this.carregaItemIdParaLista(data);
477
+ });
478
+ }
479
+ onBlur(event) {
480
+ console.log('blur', event);
481
+ //console.log(event.detail.relatedTarget);
482
+ if (event.detail.relatedTarget == null || event.detail.relatedTarget.id.indexOf(this.selectId + 'IonItem') == -1) {
483
+ //console.log("true", event.detail.relatedTarget.id);
484
+ //pesquisar item na lista
485
+ if (!this.existeNaListaTexto(this.textoPesquisa, true)) {
486
+ this.limparClick();
487
+ }
488
+ this.dropDownPesquisa(0);
489
+ if (this.form) {
490
+ this.form.get(this.formControlName)?.markAsTouched();
491
+ }
492
+ }
493
+ }
494
+ ngOnInit() {
495
+ //tratar urls
496
+ this.url = this.url.startsWith('http') ? this.url : `${this.BASE_API}/${this.url}`;
497
+ this.urlItem = this.urlItem.startsWith('http') ? this.urlItem : `${this.BASE_API}/${this.urlItem}`;
498
+ this.pesquisaSubject.pipe(switchMap((url) => {
499
+ //this.console.log('subject url:', url);
500
+ if (!this.isEmpty(url)) {
501
+ return this.httpClient.get(url);
502
+ }
503
+ else
504
+ return of([]);
505
+ }))
506
+ .subscribe({
507
+ next: (result) => {
508
+ //this.listaPesquisa = result;
509
+ this.console.log('subject subscribe result:', result);
510
+ this.listaPesquisa = [];
511
+ if (result && result.length > 0) {
512
+ if (this.filterFunction) {
513
+ result = result.filter(this.filterFunction);
514
+ }
515
+ result.forEach((ent, index) => {
516
+ this.listaPesquisa.push({ ...ent, Index: index, Selected: false });
517
+ });
518
+ }
519
+ this.podePesquisar = true;
520
+ if (this.listaPesquisa.length > 0) {
521
+ this.dropDownPesquisa(this.listaPesquisa.length);
522
+ }
523
+ },
524
+ error: (error) => {
525
+ this.podePesquisar = true;
526
+ console.log('erro pesquisa', error);
527
+ }
528
+ });
529
+ }
530
+ writePesquisa(value) {
531
+ //console.log('write pesquisa', value);
532
+ this.textoPesquisa = value;
533
+ }
534
+ showPesquisa(e) {
535
+ //console.log('show pesquisa', e.keyCode);
536
+ var self = this;
537
+ const index = e.target.selectionStart >= 1 ? (e.target.selectionStart - 1) : 0;
538
+ //console.log(index, 'valor ', event.target.value, 'char ', event.target.value.charCodeAt(index));
539
+ const keyAt = e.target.value.charCodeAt(index);
540
+ /*
541
+ if ((e.keyCode >= 48 && e.keyCode <= 57) ||
542
+ (keyAt >= 48 && keyAt <= 57) ||
543
+ (e.keyCode >= 65 && e.keyCode <= 90) ||
544
+ (e.keyCode >= 96 && e.keyCode <= 105) ||
545
+ (e.keyCode == 8)) {
546
+ */
547
+ if (e.keyCode != 40 && e.keyCode != 38) {
548
+ if (!self.podePesquisar) {
549
+ return;
550
+ }
551
+ let filtro = self.textoPesquisa;
552
+ if (filtro != null && filtro != '' && filtro.length >= 2) {
553
+ self.pesquisarEntidade(filtro);
554
+ }
555
+ else {
556
+ if (e.keyCode == 8 && !filtro) {
557
+ this.limparClick();
558
+ }
559
+ }
560
+ }
561
+ else {
562
+ if (e.keyCode == 40 || e.keyCode == 38) {
563
+ self.dropDownPesquisa(self.listaPesquisa.length);
564
+ if (self.selectElementVisivel == true) {
565
+ //let select = self.selectElement; //document.getElementById(self.TemplateSelect1Id());
566
+ //ion-list
567
+ //selecionado
568
+ //console.log(self.listaPesquisa);
569
+ let inc = e.keyCode == 40 ? 1 : -1;
570
+ let selected = self.listaPesquisa.find(s => s['Selected'] === true);
571
+ let cur = 0;
572
+ if (selected != null) {
573
+ cur = selected['Index'];
574
+ //desmarcar o atual
575
+ selected['Selected'] = false;
576
+ cur = cur + inc;
577
+ }
578
+ else {
579
+ cur = 0;
580
+ }
581
+ if (cur < 0) {
582
+ cur = self.listaPesquisa.length - 1;
583
+ }
584
+ else if (cur >= self.listaPesquisa.length) {
585
+ cur = 0;
586
+ }
587
+ let novoSelected = self.listaPesquisa.find(n => n['Index'] === cur);
588
+ if (novoSelected != null) {
589
+ novoSelected['Selected'] = true;
590
+ self.selectedItem = novoSelected;
591
+ self.textoPesquisa = novoSelected[self.campoDisplay];
592
+ }
593
+ /*
594
+ let select = document.getElementById(this.selectId) as any;
595
+ console.log('select Element', select)
596
+ if (select != null) {
597
+ let inc = e.keyCode == 40 ? 1 : -1;
598
+ let cur = select.selectedIndex;
599
+ if (cur == NaN) cur = -1;
600
+ select.selectedIndex = cur + inc;
601
+ if (select.selectedIndex >= 0 && select.selectedIndex < self.listaPesquisa.length) {
602
+ self.selectedItem = self.listaPesquisa[select.selectedIndex];
603
+ if (self.selectedItem != null) {
604
+ self.textoPesquisa = self.selectedItem[self.campoDisplay];
605
+ }
606
+ }
607
+ }
608
+ */
609
+ }
610
+ }
611
+ else if (e.keyCode == 13) {
612
+ console.log('enter key', e);
613
+ //self.selecionarComboClick(e);
614
+ self.selecionarComboClick(null);
615
+ //return false;
616
+ }
617
+ else if (e.keyCode == 27) {
618
+ //ESC
619
+ self.dropDownPesquisa(0);
620
+ }
621
+ }
622
+ }
623
+ highlight(texto) {
624
+ let index = texto.toLowerCase().indexOf(this.textoPesquisa.toLowerCase());
625
+ //console.log(index);
626
+ if (index >= 0) {
627
+ return texto.substring(0, index) + '<strong>' + texto.substring(index, index + this.textoPesquisa.length) + '</strong>' + texto.substring(index + this.textoPesquisa.length); //texto.replace(this.textoPesquisa, `<strong>${this.textoPesquisa}</strong>`);
628
+ }
629
+ else {
630
+ return texto;
631
+ }
632
+ }
633
+ selecionarComboClick(item) {
634
+ // console.log(item);
635
+ var self = this;
636
+ // console.log('combo click', self);
637
+ /*
638
+ let select = document.getElementById(this.selectId) as any;
639
+ if (select.selectedIndex >= 0) {
640
+ self.selectedItem = self.listaPesquisa[select.selectedIndex];
641
+ }
642
+ console.log('selected', this.selectedItem);
643
+ //self.selectedItem = this.listaPesquisa.find(i => i[this.campoId] == e);
644
+ if (self.selectedItem != null) {
645
+ self.textoPesquisa = self.selectedItem[self.campoDisplay];
646
+ self.writeValue(self.selectedItem[self.campoId]);
647
+ if (e != null) {
648
+ self.selectElementVisivel = false;
649
+ if (self.action != null) {
650
+ self.action(self.selectedItem(), e);
651
+ }
652
+ }
653
+ }
654
+ else {
655
+ self.selectElementVisivel = false;
656
+ }
657
+ */
658
+ // pesquisar selecionado
659
+ // console.log(this.listaPesquisa);
660
+ let selected = this.listaPesquisa.find(s => s['Selected'] === true);
661
+ // if (!selected) {
662
+ // console.log(this.campoId, item);
663
+ // selected = this.listaPesquisa.filter( s => s[this.campoId] == item[this.campoId]);
664
+ // }
665
+ //se o item form passado como parametro (click no ion-item)
666
+ if (item != null) {
667
+ if (selected != null) {
668
+ selected['Selected'] = false;
669
+ }
670
+ item['Selected'] = true;
671
+ selected = item;
672
+ }
673
+ if (selected != null) {
674
+ self.selectedItem = selected;
675
+ self.textoPesquisa = selected[self.campoDisplay];
676
+ self.writeValue(selected[self.campoId]);
677
+ self.selectElementVisivel = false;
678
+ //console.log('action', self.change);
679
+ if (self.pesquisaChange != null) {
680
+ self.pesquisaChange.emit(self.selectedItem);
681
+ }
682
+ }
683
+ else {
684
+ self.selectElementVisivel = false;
685
+ }
686
+ // this.listaPesquisa.forEach( pesquisa => {
687
+ // console.log(pesquisa, self.data);
688
+ // } );
689
+ // console.log(this.textoPesquisa);
690
+ }
691
+ selecionarComboChange(e) {
692
+ var self = this;
693
+ console.log('combo change', e);
694
+ self.selectedItem = this.listaPesquisa.find(i => i[this.campoId] == e);
695
+ if (self.selectedItem != null) {
696
+ self.writeValue(e);
697
+ self.textoPesquisa = self.selectedItem[self.campoDisplay];
698
+ if (e != null) {
699
+ self.selectElementVisivel = false;
700
+ if (self.pesquisaChange != null) {
701
+ self.pesquisaChange.emit(self.selectedItem);
702
+ }
703
+ }
704
+ }
705
+ else {
706
+ self.selectElementVisivel = false;
707
+ }
708
+ }
709
+ dropDownPesquisa(length) {
710
+ var self = this;
711
+ if (self.listaPesquisa != null && self.listaPesquisa.length > 0) {
712
+ if (length == -1) {
713
+ length = self.listaPesquisa.length;
714
+ }
715
+ self.selectElementVisivel = length == 0 ? false : true;
716
+ //console.log(this.selectElement);
717
+ //this.selectElement.open();
718
+ /*
719
+ //let element = this.selectElement;
720
+ let element = document.getElementById(this.selectId);
721
+ console.log('dropDown', element);
722
+ (element as any).size = length + 1;
723
+ if (length == 0) {
724
+ self.selectElementVisivel = false;
725
+ } else {
726
+ self.selectElementVisivel = true;
727
+ }
728
+ */
729
+ }
730
+ }
731
+ pesquisarEntidade(filtro) {
732
+ let url = this.url.replace('<<FILTRO>>', filtro).replace('<<EMPRESA>>', this.empresa.toString());
733
+ console.log('pesquisarEntidade url', url);
734
+ this.podePesquisar = false;
735
+ this.pesquisaSubject.next(url);
736
+ }
737
+ pesquisarEntidadeOld(filtro) {
738
+ let url = this.url.replace('<<FILTRO>>', filtro).replace('<<EMPRESA>>', this.empresa.toString());
739
+ console.log('pesquisarEntidade url', url);
740
+ this.podePesquisar = false;
741
+ this.httpClient.get(url)
742
+ .subscribe({ next: (result) => {
743
+ //this.listaPesquisa = result;
744
+ if (this.filterFunction) {
745
+ result = result.filter(this.filterFunction);
746
+ }
747
+ this.listaPesquisa = [];
748
+ result.forEach((ent, index) => {
749
+ this.listaPesquisa.push({ ...ent, Index: index, Selected: false });
750
+ });
751
+ this.podePesquisar = true;
752
+ if (this.listaPesquisa.length > 0) {
753
+ this.dropDownPesquisa(this.listaPesquisa.length);
754
+ }
755
+ }, error: error => {
756
+ console.log('erro pesquisa', error);
757
+ this.podePesquisar = true;
758
+ } });
759
+ }
760
+ existeNaLista(id, setRegistro = false) {
761
+ if (this.listaPesquisa && this.listaPesquisa.length > 0) {
762
+ let existe = this.listaPesquisa.find(l => l[this.campoId] === id);
763
+ if (existe) {
764
+ if (setRegistro) {
765
+ this.selectedItem = existe;
766
+ this.selecionarComboClick(this.selectedItem);
767
+ }
768
+ return true;
769
+ }
770
+ else {
771
+ return false;
772
+ }
773
+ }
774
+ else {
775
+ return false;
776
+ }
777
+ }
778
+ existeNaListaTexto(texto, setRegistro = false) {
779
+ console.log("existe texto:", texto, this.campoDisplay, this.listaPesquisa);
780
+ if (this.listaPesquisa && this.listaPesquisa.length > 0) {
781
+ let existe = this.listaPesquisa.find(l => l[this.campoDisplay].toUpperCase() === texto.toUpperCase());
782
+ if (existe) {
783
+ if (setRegistro) {
784
+ this.selectedItem = existe;
785
+ this.selecionarComboClick(this.selectedItem);
786
+ }
787
+ return true;
788
+ }
789
+ else {
790
+ return false;
791
+ }
792
+ }
793
+ else {
794
+ return false;
795
+ }
796
+ }
797
+ validarItemSelecionado(setarRegistro = false) {
798
+ console.log('validar selecionado');
799
+ //passar pela função de filtro
800
+ let valido = false;
801
+ if (this.selectedItem) {
802
+ if (this.filterFunction) {
803
+ let existe = [{ ...this.selectedItem }].filter(this.filterFunction);
804
+ if (existe != null && existe.length > 0) {
805
+ valido = true;
806
+ }
807
+ }
808
+ else {
809
+ valido = true;
810
+ }
811
+ if (valido && setarRegistro) {
812
+ this.selecionarComboClick(this.selectedItem);
813
+ }
814
+ return valido;
815
+ }
816
+ else {
817
+ return false;
818
+ }
819
+ }
820
+ carregaItemIdParaLista(id) {
821
+ let url = this.urlItem.replace('<<ID>>', id.toString());
822
+ console.log(this.urlItem);
823
+ console.log('pesquisar ID url', url);
824
+ this.podePesquisar = false;
825
+ this.httpClient.get(url)
826
+ .subscribe({ next: (result) => {
827
+ this.listaPesquisa = [];
828
+ this.listaPesquisa.push({ ...result, Index: 0, Selected: true });
829
+ this.podePesquisar = true;
830
+ if (this.listaPesquisa.length > 0) {
831
+ this.selectedItem = this.listaPesquisa[0];
832
+ this.selecionarComboClick(this.selectedItem);
833
+ }
834
+ }, error: error => {
835
+ console.log('erro pesquisa', error);
836
+ this.podePesquisar = true;
837
+ } });
838
+ }
839
+ limparClick() {
840
+ this.writeValue(null);
841
+ this.writePesquisa(null);
842
+ this.listaPesquisa = [];
843
+ this.dropDownPesquisa(0);
844
+ //this.podePesquisar = true;
845
+ this.pesquisaSubject.next('');
846
+ if (this.limpar) {
847
+ this.limpar();
848
+ }
849
+ }
850
+ verificarPesquisa() {
851
+ //TODO: verificar se o texto corresponde com um item da lista
852
+ this.selecionarComboClick(null);
853
+ }
854
+ async pesquisarClick() {
855
+ /*
856
+ if (this.pesquisaAction != null) {
857
+ this.pesquisaAction();
858
+ }
859
+ */
860
+ //pesquisaCategoria
861
+ console.log(this.filterFunction, this.url, this.urlTree);
862
+ const modal = await this.modalCtrl.create({
863
+ component: ModelTreeviewComponent,
864
+ componentProps: {
865
+ //campoId: this.campoId,
866
+ //campoPai: this.campoPaiId,
867
+ //campoLabel: this.campoDisplay,
868
+ filterFunction: this.filterFunction,
869
+ empresaSelecionadaId: this.empresa,
870
+ tipo: this.tipo,
871
+ //especifico
872
+ //planoContas: this.planoContas,
873
+ url: this.isEmpty(this.urlTree) ? this.url : this.urlTree
874
+ },
875
+ cssClass: 'my-custom-modal-pesquisa'
876
+ });
877
+ modal.onDidDismiss().then(data => {
878
+ let result = data['data'];
879
+ console.log(result);
880
+ if (result != null && result.Id > 0) {
881
+ this.carregaItemIdParaLista(result.Id);
882
+ }
883
+ });
884
+ modal.present();
885
+ }
886
+ isEmpty(valor) {
887
+ return valor == null || valor == undefined || valor == '';
888
+ }
889
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputPesquisaComponent, deps: [{ token: LibConfigService }, { token: i1$1.HttpClient }, { token: i2.ModalController }], target: i0.ɵɵFactoryTarget.Component }); }
890
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: InputPesquisaComponent, selector: "kb-input-pesquisa", inputs: { textoPesquisa: "textoPesquisa", max: "max", filterFunction: "filterFunction", selectId: "selectId", campoId: "campoId", campoPaiId: "campoPaiId", campoDisplay: "campoDisplay", tipo: "tipo", pesquisaChange: "pesquisaChange", pesquisaAction: "pesquisaAction", limpar: "limpar", url: "url", urlItem: "urlItem", urlTree: "urlTree", empresa: "empresa", loadInit: "loadInit" }, providers: [{
891
+ provide: NG_VALUE_ACCESSOR,
892
+ useExisting: InputPesquisaComponent,
893
+ multi: true
894
+ }], viewQueries: [{ propertyName: "selectElement", first: true, predicate: ["selectElement"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div style=\"padding-inline-end: 0px;\">\r\n <ion-item lines=\"none\" style=\"--background: inherited; --background-focused: transparent; margin-top: 2px;\" [class]=\"itemClass\">\r\n <ion-label position=\"{{ labelPosition }}\" color=\"{{ labelColor }}\">{{ label }}</ion-label>\r\n <!-- formControlName=\"{{ campo }}\" -->\r\n <ion-spinner *ngIf=\"!podePesquisar\"\r\n style=\"--min-height: 0px !important; margin-inline-end: 5px !important; margin-top: 16px;\" \r\n slot=\"start\" name=\"lines\"></ion-spinner>\r\n <!-- (ionBlur)=\"verificarPesquisa()\" -->\r\n <!-- conflito com click da lista -->\r\n <ion-input #inputPesquisa\r\n type=\"{{type}}\" \r\n [placeholder]=\"placeholder\" \r\n maxlength=\"{{ max }}\" \r\n (ionBlur)=\"onBlur($event)\"\r\n [value]=\"textoPesquisa\" (input)=\"writePesquisa(inputPesquisa.value)\" \r\n (keyup)=\"showPesquisa($event)\"\r\n autocomplete=\"off\" [style.--background]=\"inputBackgroungColor\"\r\n (click)=\"dropDownPesquisa(-1)\"\r\n [disabled]=\"readonly\" debounce=\"500\"></ion-input>\r\n <ion-button size=\"small\" slot=\"end\" tabindex=\"-1\"\r\n style=\"margin-top: 25px; margin-inline-start: 4px !important; --padding-start:2px; --padding-end: 2px;\" fill=\"clear\" color=\"medium\"\r\n (click)=\"limparClick()\">\r\n <ion-icon name=\"close-outline\"></ion-icon>\r\n </ion-button>\r\n \r\n <!--\r\n <ion-button size=\"small\" slot=\"end\" tabindex=\"-1\"\r\n style=\"margin-top: 25px; margin-inline-start: 4px !important; --padding-start:2px; --padding-end: 2px;\" fill=\"clear\" color=\"medium\"\r\n (click)=\"pesquisarClick()\">\r\n <ion-icon color=\"primary\" name=\"search\"></ion-icon>\r\n </ion-button>\r\n -->\r\n \r\n </ion-item>\r\n \r\n <ion-list tabindex=\"-1\" [hidden]=\"!selectElementVisivel || !listaPesquisa || listaPesquisa.length == 0\" class=\"pesquisa-list\" style=\"max-height: 250px; overflow-y: auto;\">\r\n \r\n <ion-item tabindex=\"-1\" button *ngFor=\"let item of listaPesquisa\" \r\n (click)=\"selecionarComboClick(item)\" [id]=\"selectId + 'IonItem' + item['Index']\"\r\n class=\"pesquisa-item\">\r\n <!-- {{ item | json}} -->\r\n <span [class]=\"{'selected-item': item['Selected'] === true}\" [innerHTML]=\"highlight(item[campoDisplay])\"></span>\r\n </ion-item>\r\n \r\n </ion-list>\r\n \r\n <!--\r\n <ion-select interface=\"popover\" #selectElement tabindex=\"-1\" [hidden]=\"!selectElementVisivel\"\r\n (ionChange)=\"selecionarComboChange($event.target.value)\">\r\n <ion-select-option *ngFor=\"let item of listaPesquisa\" [value]=\"item[campoId]\" (click)=\"selecionarComboClick(item[campoId])\">\r\n {{ item[campoDisplay] }}\r\n </ion-select-option>\r\n </ion-select>\r\n -->\r\n \r\n <!--\r\n <select [id]=\"selectId\" #selectElement tabindex=\"-1\" [hidden]=\"!selectElementVisivel\"\r\n (change)=\"selecionarComboChange($event.target.value)\" class=\"pesquisa-select\">\r\n <option *ngFor=\"let item of listaPesquisa\" [value]=\"item[campoId]\" (click)=\"selecionarComboClick(item[campoId])\">\r\n {{ item[campoDisplay] }}\r\n </option>\r\n \r\n </select>\r\n -->\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n \r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n \r\n </div>\r\n </div>", styles: [".pesquisa-select{display:block;position:absolute;top:58px;left:20px;width:100%;z-index:800;font-size:16px;font-family:Roboto,Helvetica Neue,sans-serif;border-bottom-left-radius:5px;border-bottom-right-radius:5px}.pesquisa-select option{overflow-y:hidden}.pesquisa-select option:hover,.pesquisa-select option:checked{background-color:#add8e6}.pesquisa-list{display:block;position:absolute;margin-left:20px;margin-top:-4px;width:calc(100% - 50px);z-index:800;border:1px lightgrey solid;border-bottom-left-radius:5px;border-bottom-right-radius:5px;padding:0}.pesquisa-item{--inner-padding-top: 0px;--inner-padding-bottom: 0px;--padding-top: 0px;--padding-bottom: 0px;--min-height: 30px !important;font-size:12px}.pesquisa-item button{padding:0}.selected-item{background-color:#add8e6}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "legacy", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "component", type: i2.IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "directive", type: i2.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }] }); }
895
+ }
896
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputPesquisaComponent, decorators: [{
897
+ type: Component,
898
+ args: [{ selector: 'kb-input-pesquisa', providers: [{
899
+ provide: NG_VALUE_ACCESSOR,
900
+ useExisting: InputPesquisaComponent,
901
+ multi: true
902
+ }], template: "<div style=\"padding-inline-end: 0px;\">\r\n <ion-item lines=\"none\" style=\"--background: inherited; --background-focused: transparent; margin-top: 2px;\" [class]=\"itemClass\">\r\n <ion-label position=\"{{ labelPosition }}\" color=\"{{ labelColor }}\">{{ label }}</ion-label>\r\n <!-- formControlName=\"{{ campo }}\" -->\r\n <ion-spinner *ngIf=\"!podePesquisar\"\r\n style=\"--min-height: 0px !important; margin-inline-end: 5px !important; margin-top: 16px;\" \r\n slot=\"start\" name=\"lines\"></ion-spinner>\r\n <!-- (ionBlur)=\"verificarPesquisa()\" -->\r\n <!-- conflito com click da lista -->\r\n <ion-input #inputPesquisa\r\n type=\"{{type}}\" \r\n [placeholder]=\"placeholder\" \r\n maxlength=\"{{ max }}\" \r\n (ionBlur)=\"onBlur($event)\"\r\n [value]=\"textoPesquisa\" (input)=\"writePesquisa(inputPesquisa.value)\" \r\n (keyup)=\"showPesquisa($event)\"\r\n autocomplete=\"off\" [style.--background]=\"inputBackgroungColor\"\r\n (click)=\"dropDownPesquisa(-1)\"\r\n [disabled]=\"readonly\" debounce=\"500\"></ion-input>\r\n <ion-button size=\"small\" slot=\"end\" tabindex=\"-1\"\r\n style=\"margin-top: 25px; margin-inline-start: 4px !important; --padding-start:2px; --padding-end: 2px;\" fill=\"clear\" color=\"medium\"\r\n (click)=\"limparClick()\">\r\n <ion-icon name=\"close-outline\"></ion-icon>\r\n </ion-button>\r\n \r\n <!--\r\n <ion-button size=\"small\" slot=\"end\" tabindex=\"-1\"\r\n style=\"margin-top: 25px; margin-inline-start: 4px !important; --padding-start:2px; --padding-end: 2px;\" fill=\"clear\" color=\"medium\"\r\n (click)=\"pesquisarClick()\">\r\n <ion-icon color=\"primary\" name=\"search\"></ion-icon>\r\n </ion-button>\r\n -->\r\n \r\n </ion-item>\r\n \r\n <ion-list tabindex=\"-1\" [hidden]=\"!selectElementVisivel || !listaPesquisa || listaPesquisa.length == 0\" class=\"pesquisa-list\" style=\"max-height: 250px; overflow-y: auto;\">\r\n \r\n <ion-item tabindex=\"-1\" button *ngFor=\"let item of listaPesquisa\" \r\n (click)=\"selecionarComboClick(item)\" [id]=\"selectId + 'IonItem' + item['Index']\"\r\n class=\"pesquisa-item\">\r\n <!-- {{ item | json}} -->\r\n <span [class]=\"{'selected-item': item['Selected'] === true}\" [innerHTML]=\"highlight(item[campoDisplay])\"></span>\r\n </ion-item>\r\n \r\n </ion-list>\r\n \r\n <!--\r\n <ion-select interface=\"popover\" #selectElement tabindex=\"-1\" [hidden]=\"!selectElementVisivel\"\r\n (ionChange)=\"selecionarComboChange($event.target.value)\">\r\n <ion-select-option *ngFor=\"let item of listaPesquisa\" [value]=\"item[campoId]\" (click)=\"selecionarComboClick(item[campoId])\">\r\n {{ item[campoDisplay] }}\r\n </ion-select-option>\r\n </ion-select>\r\n -->\r\n \r\n <!--\r\n <select [id]=\"selectId\" #selectElement tabindex=\"-1\" [hidden]=\"!selectElementVisivel\"\r\n (change)=\"selecionarComboChange($event.target.value)\" class=\"pesquisa-select\">\r\n <option *ngFor=\"let item of listaPesquisa\" [value]=\"item[campoId]\" (click)=\"selecionarComboClick(item[campoId])\">\r\n {{ item[campoDisplay] }}\r\n </option>\r\n \r\n </select>\r\n -->\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n \r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n \r\n </div>\r\n </div>", styles: [".pesquisa-select{display:block;position:absolute;top:58px;left:20px;width:100%;z-index:800;font-size:16px;font-family:Roboto,Helvetica Neue,sans-serif;border-bottom-left-radius:5px;border-bottom-right-radius:5px}.pesquisa-select option{overflow-y:hidden}.pesquisa-select option:hover,.pesquisa-select option:checked{background-color:#add8e6}.pesquisa-list{display:block;position:absolute;margin-left:20px;margin-top:-4px;width:calc(100% - 50px);z-index:800;border:1px lightgrey solid;border-bottom-left-radius:5px;border-bottom-right-radius:5px;padding:0}.pesquisa-item{--inner-padding-top: 0px;--inner-padding-bottom: 0px;--padding-top: 0px;--padding-bottom: 0px;--min-height: 30px !important;font-size:12px}.pesquisa-item button{padding:0}.selected-item{background-color:#add8e6}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"] }]
903
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
904
+ type: Inject,
905
+ args: [LibConfigService]
906
+ }] }, { type: i1$1.HttpClient }, { type: i2.ModalController }], propDecorators: { textoPesquisa: [{
907
+ type: Input
908
+ }], max: [{
909
+ type: Input
910
+ }], filterFunction: [{
911
+ type: Input
912
+ }], selectId: [{
913
+ type: Input
914
+ }], campoId: [{
915
+ type: Input
916
+ }], campoPaiId: [{
917
+ type: Input
918
+ }], campoDisplay: [{
919
+ type: Input
920
+ }], tipo: [{
921
+ type: Input
922
+ }], selectElement: [{
923
+ type: ViewChild,
924
+ args: ['selectElement', { static: false }]
925
+ }], pesquisaChange: [{
926
+ type: Input
927
+ }], pesquisaAction: [{
928
+ type: Input
929
+ }], limpar: [{
930
+ type: Input
931
+ }], url: [{
932
+ type: Input
933
+ }], urlItem: [{
934
+ type: Input
935
+ }], urlTree: [{
936
+ type: Input
937
+ }], empresa: [{
938
+ type: Input
939
+ }], loadInit: [{
940
+ type: Input
941
+ }] } });
942
+
943
+ class InputValorComponent extends BaseInputComponent {
944
+ writeValue(value) {
945
+ //console.log('write value', value);
946
+ this.onChange(value);
947
+ this.data = value;
948
+ }
949
+ registerOnChange(fn) {
950
+ this.onChange = fn;
951
+ }
952
+ registerOnTouched(fn) {
953
+ this.onTouch = fn;
954
+ }
955
+ setDisabledState(isDisabled) {
956
+ this.disabled = this.disabled;
957
+ }
958
+ constructor() {
959
+ super();
960
+ this.maxValor = null;
961
+ this.onChange = (data) => { };
962
+ this.onTouch = () => { };
963
+ this.disabled = false;
964
+ this.console = console;
965
+ }
966
+ ngOnInit() { }
967
+ onBlur() {
968
+ if (this.form) {
969
+ this.form.get(this.formControlName)?.markAsTouched();
970
+ }
971
+ //verificar o valor
972
+ if (this.maxValor) {
973
+ if (this.form) {
974
+ //console.log(this.form.get(this.formControlName).value);
975
+ let valor = this.strToFloatZero(this.form.get(this.formControlName).value);
976
+ if (valor > this.maxValor) {
977
+ this.form.patchValue({
978
+ [this.formControlName]: this.converterValorDecimalMil((this.maxValor * 100).toString())
979
+ });
980
+ }
981
+ }
982
+ else {
983
+ let valor = this.strToFloatZero(this.data);
984
+ if (valor > this.maxValor) {
985
+ this.data = this.converterValorDecimalMil((this.maxValor * 100).toString());
986
+ this.writeValue(this.data);
987
+ }
988
+ }
989
+ }
990
+ if (this.blur) {
991
+ this.blur.emit(this.blurArgs);
992
+ }
993
+ }
994
+ digitarValor(event) {
995
+ //this.item.vendaunitario = this.utils.converterValorDecimal(this.item.vendaunitario);
996
+ setTimeout(() => {
997
+ if (this.form) {
998
+ this.form.patchValue({
999
+ [this.formControlName]: this.converterValorDecimalMil(this.form.get(this.formControlName)?.value)
1000
+ });
1001
+ }
1002
+ else {
1003
+ this.data = this.converterValorDecimalMil(this.data);
1004
+ this.writeValue(this.data);
1005
+ }
1006
+ }, 100);
1007
+ return true;
1008
+ }
1009
+ isEmpty(str) {
1010
+ return str == null || str == undefined || str == '';
1011
+ }
1012
+ converterValorDecimalMil(campo, casas = 2) {
1013
+ if (!this.isEmpty(campo)) {
1014
+ //console.log('converterValorDecimal');
1015
+ //console.log('campo:', campo, ' replaced: ', campo.replace(',', '').replace('.', ''));
1016
+ if (campo == '-') {
1017
+ return campo;
1018
+ }
1019
+ let valor = parseFloat(campo.replace(',', '').replace('.', '').replace('.', '').replace('.', ''));
1020
+ if (isNaN(valor)) {
1021
+ return '';
1022
+ }
1023
+ let valordiv = parseInt("1" + this.stringOfChar("0", casas));
1024
+ //valor /= 100;
1025
+ console.log(valor, '/', valordiv);
1026
+ valor /= valordiv;
1027
+ console.log('=', valor);
1028
+ return this.decimalToStringMil(valor);
1029
+ /*
1030
+ var str = valor.toString().replace('.', ',');
1031
+ var aStr = str.split(',');
1032
+ if (aStr.length == 1) {
1033
+ //str += ',00';
1034
+ str += ',' + this.stringOfChar('0', casas);
1035
+ }
1036
+ else {
1037
+ //str += this.stringOfChar('0', 2 - aStr[1].length);
1038
+ str += this.stringOfChar('0', casas - aStr[1].length);
1039
+ }
1040
+ return str;
1041
+ */
1042
+ }
1043
+ else
1044
+ return campo;
1045
+ }
1046
+ decimalToStringMil(number) {
1047
+ if (number != null) {
1048
+ if (number == 0 || number == '0') {
1049
+ return '0,00';
1050
+ }
1051
+ //console.log(number);
1052
+ let numero = number.toFixed(2).split('.');
1053
+ numero[0] = numero[0].split(/(?=(?:...)*$)/).join('.');
1054
+ return numero.join(',').replace('-.', '-');
1055
+ }
1056
+ else
1057
+ return '';
1058
+ }
1059
+ stringOfChar(str, tam) {
1060
+ var res = '';
1061
+ for (var i = 0; i < tam; i++) {
1062
+ res += str;
1063
+ }
1064
+ return res;
1065
+ }
1066
+ strToFloatZero(str) {
1067
+ if (Number.isFinite(str))
1068
+ return str;
1069
+ if (this.isEmpty(str))
1070
+ return 0;
1071
+ else
1072
+ return parseFloat(str.replace('.', '').replace(',', '.'));
1073
+ }
1074
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputValorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1075
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: InputValorComponent, selector: "kb-input-valor", inputs: { maxValor: "maxValor" }, providers: [{
1076
+ provide: NG_VALUE_ACCESSOR,
1077
+ useExisting: InputValorComponent,
1078
+ multi: true
1079
+ }], viewQueries: [{ propertyName: "inputValorEdit", first: true, predicate: ["inputValor"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<!--\r\n<div [formGroup]=\"form\">\r\n-->\r\n<div>\r\n <ion-item lines=\"none\" style=\"--background-focused: transparent;\" [class]=\"itemClass\"\r\n [ngClass]=\"form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' \"\r\n >\r\n <ion-label position=\"{{ labelPosition }}\">{{ label }}</ion-label>\r\n <!-- formControlName=\"{{ formControlName }}\" -->\r\n <ion-input #inputValor\r\n type=\"text\" \r\n [placeholder]=\"placeholder\" \r\n maxlength=\"{{ max }}\"\r\n (ionBlur)=\"onBlur()\"\r\n [value]=\"data\"\r\n (input)=\"writeValue(inputValor.value)\" \r\n (keypress)=\"digitarValor($event)\"\r\n [clearInput]=\"botaoLimpar\"\r\n [disabled]=\"readonly\"></ion-input>\r\n </ion-item>\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n \r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n \r\n </div>\r\n </div>", styles: [".item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end}.align-to-right ion-label{position:relative;left:25%;text-align:end}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "legacy", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "directive", type: i2.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }] }); }
1080
+ }
1081
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputValorComponent, decorators: [{
1082
+ type: Component,
1083
+ args: [{ selector: 'kb-input-valor', providers: [{
1084
+ provide: NG_VALUE_ACCESSOR,
1085
+ useExisting: InputValorComponent,
1086
+ multi: true
1087
+ }], template: "<!--\r\n<div [formGroup]=\"form\">\r\n-->\r\n<div>\r\n <ion-item lines=\"none\" style=\"--background-focused: transparent;\" [class]=\"itemClass\"\r\n [ngClass]=\"form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' \"\r\n >\r\n <ion-label position=\"{{ labelPosition }}\">{{ label }}</ion-label>\r\n <!-- formControlName=\"{{ formControlName }}\" -->\r\n <ion-input #inputValor\r\n type=\"text\" \r\n [placeholder]=\"placeholder\" \r\n maxlength=\"{{ max }}\"\r\n (ionBlur)=\"onBlur()\"\r\n [value]=\"data\"\r\n (input)=\"writeValue(inputValor.value)\" \r\n (keypress)=\"digitarValor($event)\"\r\n [clearInput]=\"botaoLimpar\"\r\n [disabled]=\"readonly\"></ion-input>\r\n </ion-item>\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n \r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n \r\n </div>\r\n </div>", styles: [".item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end}.align-to-right ion-label{position:relative;left:25%;text-align:end}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"] }]
1088
+ }], ctorParameters: () => [], propDecorators: { maxValor: [{
1089
+ type: Input
1090
+ }], inputValorEdit: [{
1091
+ type: ViewChild,
1092
+ args: ['inputValor', { read: ElementRef, static: true }]
1093
+ }] } });
1094
+
1095
+ class InputAreaComponent extends BaseInputComponent {
1096
+ writeValue(value) {
1097
+ //console.log('write value', value);
1098
+ this.onChange(value);
1099
+ this.data = value;
1100
+ }
1101
+ registerOnChange(fn) {
1102
+ this.onChange = fn;
1103
+ }
1104
+ registerOnTouched(fn) {
1105
+ this.onTouch = fn;
1106
+ }
1107
+ setDisabledState(isDisabled) {
1108
+ this.disabled = this.disabled;
1109
+ }
1110
+ constructor() {
1111
+ super();
1112
+ this.linhas = 5;
1113
+ this.onChange = (data) => { };
1114
+ this.onTouch = () => { };
1115
+ this.disabled = false;
1116
+ this.console = console;
1117
+ }
1118
+ ngOnInit() { }
1119
+ onBlur() {
1120
+ if (this.form) {
1121
+ this.form.get(this.formControlName)?.markAsTouched();
1122
+ }
1123
+ }
1124
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputAreaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1125
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: InputAreaComponent, selector: "kb-input-area", inputs: { linhas: "linhas" }, providers: [{
1126
+ provide: NG_VALUE_ACCESSOR,
1127
+ useExisting: InputAreaComponent,
1128
+ multi: true
1129
+ }], usesInheritance: true, ngImport: i0, template: "<div>\r\n <ion-item lines=\"none\" style=\"--background-focused: transparent;\" [class]=\"itemClass\">\r\n <ion-label position=\"{{ labelPosition }}\">{{ label }}</ion-label>\r\n <!-- formControlName=\"{{ formControlName }}\" -->\r\n <ion-textarea #inputArea \r\n [placeholder]=\"placeholder\" \r\n maxlength=\"{{ max }}\"\r\n (ionBlur)=\"onBlur()\"\r\n [value]=\"data\"\r\n [rows]=\"linhas\" \r\n (input)=\"writeValue(inputArea.value)\"\r\n [disabled]=\"readonly\"></ion-textarea>\r\n </ion-item>\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n \r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n \r\n </div>\r\n </div>", styles: ["ion-label{margin-bottom:4px!important}ion-textarea{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonTextarea, selector: "ion-textarea", inputs: ["autoGrow", "autocapitalize", "autofocus", "clearOnEdit", "color", "cols", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "legacy", "maxlength", "minlength", "mode", "name", "placeholder", "readonly", "required", "rows", "shape", "spellcheck", "value", "wrap"] }, { kind: "directive", type: i2.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }] }); }
1130
+ }
1131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputAreaComponent, decorators: [{
1132
+ type: Component,
1133
+ args: [{ selector: 'kb-input-area', providers: [{
1134
+ provide: NG_VALUE_ACCESSOR,
1135
+ useExisting: InputAreaComponent,
1136
+ multi: true
1137
+ }], template: "<div>\r\n <ion-item lines=\"none\" style=\"--background-focused: transparent;\" [class]=\"itemClass\">\r\n <ion-label position=\"{{ labelPosition }}\">{{ label }}</ion-label>\r\n <!-- formControlName=\"{{ formControlName }}\" -->\r\n <ion-textarea #inputArea \r\n [placeholder]=\"placeholder\" \r\n maxlength=\"{{ max }}\"\r\n (ionBlur)=\"onBlur()\"\r\n [value]=\"data\"\r\n [rows]=\"linhas\" \r\n (input)=\"writeValue(inputArea.value)\"\r\n [disabled]=\"readonly\"></ion-textarea>\r\n </ion-item>\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n \r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n \r\n </div>\r\n </div>", styles: ["ion-label{margin-bottom:4px!important}ion-textarea{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px}\n", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"] }]
1138
+ }], ctorParameters: () => [], propDecorators: { linhas: [{
1139
+ type: Input
1140
+ }] } });
1141
+
1142
+ class InputCepComponent extends BaseInputComponent {
1143
+ constructor() {
1144
+ super();
1145
+ this.formato = '00000-000';
1146
+ this.keyEnter = null;
1147
+ this.getResultados = null;
1148
+ //control value acessor
1149
+ this.data = null;
1150
+ this.onChange = (data) => { };
1151
+ this.onTouch = () => { };
1152
+ this.disabled = false;
1153
+ }
1154
+ writeValue(value) {
1155
+ //console.log('write value', value);
1156
+ this.onChange(value);
1157
+ this.data = value;
1158
+ }
1159
+ registerOnChange(fn) {
1160
+ this.onChange = fn;
1161
+ }
1162
+ registerOnTouched(fn) {
1163
+ this.onTouch = fn;
1164
+ }
1165
+ setDisabledState(isDisabled) {
1166
+ this.disabled = this.disabled;
1167
+ }
1168
+ ngOnInit() {
1169
+ }
1170
+ digitarFormatado(event) {
1171
+ console.log(event);
1172
+ if ((event.keyCode >= 48 && event.keyCode <= 57)
1173
+ || (event.keyCode >= 96 && event.keyCode <= 105)
1174
+ || (event.keyCode == 8)
1175
+ || (event.keyCode == 9)
1176
+ || (event.keyCode == 39)
1177
+ || (event.keyCode == 37)
1178
+ || (event.keyCode == 46)) {
1179
+ //console.log(this.formControlName, this.form.get(this.formControlName).value);
1180
+ setTimeout(() => {
1181
+ if (this.form) {
1182
+ this.form.patchValue({
1183
+ [this.formControlName]: this.formataCampoValor(this.form.get(this.formControlName)?.value, this.formato ?? '', event)
1184
+ });
1185
+ }
1186
+ else {
1187
+ this.data = this.formataCampoValor(this.data ?? '', this.formato ?? '', event);
1188
+ this.writeValue(this.data);
1189
+ }
1190
+ }, 100);
1191
+ return true;
1192
+ }
1193
+ else {
1194
+ return false;
1195
+ }
1196
+ }
1197
+ onKeyEnter() {
1198
+ if (this.keyEnter != null) {
1199
+ this.keyEnter();
1200
+ }
1201
+ else {
1202
+ if (this.getResultados != null) {
1203
+ this.pesquisarClick();
1204
+ }
1205
+ }
1206
+ }
1207
+ onBlur() {
1208
+ if (this.form) {
1209
+ this.form.get(this.formControlName)?.markAsTouched();
1210
+ }
1211
+ if (this.blur) {
1212
+ this.blur.emit(this.blurArgs);
1213
+ }
1214
+ }
1215
+ formataCampoValor(valor, Mascara, evento) {
1216
+ console.log(valor);
1217
+ if (!valor)
1218
+ return null;
1219
+ //console.log(evento);
1220
+ //if (!this.keypressInteiro(evento))
1221
+ // return;
1222
+ var boleanoMascara;
1223
+ var Digitato = evento != null ? evento.keyCode : 0;
1224
+ let exp = /\-|\.|\/|\(|\)| /g;
1225
+ let campoSoNumeros = valor.replace(exp, "");
1226
+ var posicaoCampo = 0;
1227
+ var NovoValorCampo = "";
1228
+ var TamanhoMascara = campoSoNumeros.length;
1229
+ ;
1230
+ if (Digitato != 8) { // backspace
1231
+ for (let i = 0; i <= TamanhoMascara; i++) {
1232
+ boleanoMascara = ((Mascara.charAt(i) == "-") || (Mascara.charAt(i) == ".")
1233
+ || (Mascara.charAt(i) == "/"));
1234
+ boleanoMascara = boleanoMascara || ((Mascara.charAt(i) == "(")
1235
+ || (Mascara.charAt(i) == ")") || (Mascara.charAt(i) == " "));
1236
+ if (boleanoMascara) {
1237
+ NovoValorCampo += Mascara.charAt(i);
1238
+ TamanhoMascara++;
1239
+ }
1240
+ else {
1241
+ NovoValorCampo += campoSoNumeros.charAt(posicaoCampo);
1242
+ posicaoCampo++;
1243
+ }
1244
+ }
1245
+ return NovoValorCampo;
1246
+ }
1247
+ else {
1248
+ return valor;
1249
+ }
1250
+ }
1251
+ pesquisarClick() {
1252
+ const cep = this.data;
1253
+ //se não estiver informado o cep, não fazer a pesquisa
1254
+ if (cep == null || cep == "") {
1255
+ return;
1256
+ }
1257
+ this.getEnderecoPeloCep(cep).subscribe({
1258
+ next: (result) => {
1259
+ console.log('result CEP', result);
1260
+ let cidadePesquisa = result.localidade;
1261
+ cidadePesquisa = this.converteCaracteresEspeciais(cidadePesquisa.toUpperCase());
1262
+ if (this.getResultados) {
1263
+ this.getResultados(result);
1264
+ }
1265
+ }, error: (error) => {
1266
+ }
1267
+ });
1268
+ }
1269
+ //substituição de caracteres
1270
+ converteCaracteresEspeciais(nome) {
1271
+ var res = nome.replace(/Ã/g, "A");
1272
+ res = res.replace(/Á/g, "A");
1273
+ res = res.replace(/Ç/g, "C");
1274
+ res = res.replace(/É/g, "E");
1275
+ res = res.replace(/Â/g, "A");
1276
+ res = res.replace(/Ô/g, "O");
1277
+ res = res.replace(/Ó/g, "O");
1278
+ res = res.replace(/Ú/g, "U");
1279
+ res = res.replace(/Í/g, "I");
1280
+ return res;
1281
+ }
1282
+ getEnderecoPeloCep(cep) {
1283
+ return new Observable((x) => {
1284
+ var request = new XMLHttpRequest();
1285
+ request.open('get', `https://viacep.com.br/ws/${cep}/json/`, true);
1286
+ request.send();
1287
+ request.onload = function () {
1288
+ var data = JSON.parse(this.response);
1289
+ x.next(data);
1290
+ };
1291
+ });
1292
+ }
1293
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputCepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1294
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: InputCepComponent, selector: "kb-input-cep", inputs: { formato: "formato", keyEnter: "keyEnter", getResultados: "getResultados" }, providers: [{
1295
+ provide: NG_VALUE_ACCESSOR,
1296
+ useExisting: InputCepComponent,
1297
+ multi: true
1298
+ }], usesInheritance: true, ngImport: i0, template: "<!--\r\n<div [formGroup]=\"form\">\r\n-->\r\n<!--comando --inner-padding-end: utilizado pra remover padding desnecess\u00E1rios-->\r\n<div>\r\n <ion-item lines=\"none\" style=\"--background: inherited;--background-focused: transparent;--inner-padding-end: 0px;\" [class]=\"itemClass\"\r\n [ngClass]=\"form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' \"\r\n >\r\n <ion-label [position]=\"labelPosition\">{{ label }}</ion-label>\r\n <!-- formControlName={{formControlName}} -->\r\n <ion-input #inputCep\r\n type=\"tel\" \r\n [placeholder]=\"placeholder\"\r\n maxlength=\"{{ max }}\" \r\n (keydown)=\"digitarFormatado($event)\" \r\n (keyup.enter)=\"onKeyEnter()\"\r\n (ionBlur)=\"onBlur()\"\r\n [value]=\"data\"\r\n (input)=\"writeValue(inputCep.value)\"\r\n [disabled]=\"readonly\"></ion-input>\r\n\r\n <ion-button size=\"small\" slot=\"end\" tabindex=\"-1\"\r\n style=\"margin-top: 25px; margin-inline-start: 4px !important; --padding-start:2px; --padding-end: 2px;\" fill=\"clear\" color=\"medium\"\r\n (click)=\"pesquisarClick()\">\r\n <ion-icon color=\"primary\" name=\"search\"></ion-icon>\r\n </ion-button>\r\n \r\n </ion-item>\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form && form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>", styles: ["", "@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "legacy", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "directive", type: i2.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }] }); }
1299
+ }
1300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputCepComponent, decorators: [{
1301
+ type: Component,
1302
+ args: [{ selector: 'kb-input-cep', providers: [{
1303
+ provide: NG_VALUE_ACCESSOR,
1304
+ useExisting: InputCepComponent,
1305
+ multi: true
1306
+ }], template: "<!--\r\n<div [formGroup]=\"form\">\r\n-->\r\n<!--comando --inner-padding-end: utilizado pra remover padding desnecess\u00E1rios-->\r\n<div>\r\n <ion-item lines=\"none\" style=\"--background: inherited;--background-focused: transparent;--inner-padding-end: 0px;\" [class]=\"itemClass\"\r\n [ngClass]=\"form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' \"\r\n >\r\n <ion-label [position]=\"labelPosition\">{{ label }}</ion-label>\r\n <!-- formControlName={{formControlName}} -->\r\n <ion-input #inputCep\r\n type=\"tel\" \r\n [placeholder]=\"placeholder\"\r\n maxlength=\"{{ max }}\" \r\n (keydown)=\"digitarFormatado($event)\" \r\n (keyup.enter)=\"onKeyEnter()\"\r\n (ionBlur)=\"onBlur()\"\r\n [value]=\"data\"\r\n (input)=\"writeValue(inputCep.value)\"\r\n [disabled]=\"readonly\"></ion-input>\r\n\r\n <ion-button size=\"small\" slot=\"end\" tabindex=\"-1\"\r\n style=\"margin-top: 25px; margin-inline-start: 4px !important; --padding-start:2px; --padding-end: 2px;\" fill=\"clear\" color=\"medium\"\r\n (click)=\"pesquisarClick()\">\r\n <ion-icon color=\"primary\" name=\"search\"></ion-icon>\r\n </ion-button>\r\n \r\n </ion-item>\r\n \r\n <div class=\"validation-errors\" *ngIf=\"form\">\r\n <ng-container *ngFor=\"let validation of validation_messages\">\r\n <div class=\"error-message\"\r\n *ngIf=\"form && form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)\">\r\n &#8226; {{ validation.message }}\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>", styles: ["@charset \"UTF-8\";ion-label{margin-bottom:4px!important}ion-item ion-label{overflow:initial!important}ion-input{padding:var(--input-padding, 8px)!important;border:1px solid darkgray;border-radius:4px;width:100%;margin-top:2px;max-height:var(--input-max-height, 29px);transition:.2s ease}.has-focus{border:1px solid var(--ion-color-bluetool, #1f477d)}input:focus ion-input,input:focus ion-textarea{border:1px solid lightblue!important}input:focus ion-label{--color: blue !important}input:disabled{opacity:.9!important}.error-message{font-size:small;color:var(--error-text-color, red);margin-left:15px}.padding{padding:auto}.no-padding{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px;height:55px!important}.no-padding-end{--inner-padding-end: 0px}.no-padding-no-height{--inner-padding-end: 0px;--padding-start: 0px;--padding-bottom: 0px;--inner-padding-bottom: 0px}.padding-top{--padding-top: 0px}.item-inner{padding-right:0!important}.label-right ion-label{transform-origin:right top;align-self:flex-end;margin-bottom:4%!important}.align-to-right ion-label{position:relative;left:25%;text-align:end}.error-input ion-input,.error-shake ion-input{animation:shake .4s 1 linear;border:1px solid var(--error-text-color, red)!important}@keyframes shake{0%{transform:translate(20px)}20%{transform:translate(-20px)}40%{transform:translate(10px)}60%{transform:translate(-10px)}80%{transform:translate(4px)}to{transform:translate(0)}}.error-input ion-label,.error-shake ion-label{color:var(--error-text-color, red)!important}.error-input ion-input,.error-shake ion-input{border:1px solid red!important}.error-shake ion-input{animation:shake .4s 1 linear}\n"] }]
1307
+ }], ctorParameters: () => [], propDecorators: { formato: [{
1308
+ type: Input
1309
+ }], keyEnter: [{
1310
+ type: Input
1311
+ }], getResultados: [{
1312
+ type: Input
1313
+ }] } });
1314
+
1315
+ class InputArquivoComponent {
1316
+ showImageBrowser() {
1317
+ this.myInput.nativeElement.click();
1318
+ }
1319
+ writeValue(value) {
1320
+ this.onChange(value);
1321
+ this.data = value;
1322
+ if (this.callback)
1323
+ this.callback.emit(this.filename);
1324
+ }
1325
+ registerOnChange(fn) {
1326
+ this.onChange = fn;
1327
+ }
1328
+ registerOnTouched(fn) {
1329
+ this.onTouch = fn;
1330
+ }
1331
+ setDisabledState(isDisabled) {
1332
+ this.disabled = this.disabled;
1333
+ }
1334
+ constructor() {
1335
+ this.subir = false;
1336
+ this.callback = new EventEmitter();
1337
+ this.form = false;
1338
+ this.showIcon = false;
1339
+ this.sucessoEvent = new Subject();
1340
+ this.onChange = (selectedColor) => { };
1341
+ this.onTouch = () => { };
1342
+ this.disabled = false;
1343
+ }
1344
+ ngOnInit() {
1345
+ }
1346
+ loadImagem() {
1347
+ //console.log(this.myInput);
1348
+ if (this.form) {
1349
+ this.formFile = this.myInput.nativeElement.files[0];
1350
+ this.sucessoEvent.next(true);
1351
+ }
1352
+ else {
1353
+ this.formFile = this.myInput.nativeElement.files[0];
1354
+ this.getBase64FromFile(this.myInput.nativeElement.files[0])
1355
+ .then(result => {
1356
+ //console.log('file: ', result.toString());
1357
+ //console.log('nome do arquivo: ', this.nomeArquivo.toLowerCase());
1358
+ let searchstr = result.toString().substring(0, result.toString().indexOf('base64,')) + 'base64,';
1359
+ console.log('searchstring', searchstr);
1360
+ if (this.subir) {
1361
+ this.captureDataUrl = result.toString().replace(searchstr, '');
1362
+ }
1363
+ else {
1364
+ this.captureDataUrl = result.toString();
1365
+ }
1366
+ //this.utils.showToast('Imagem carregada em memória.');
1367
+ this.sucessoEvent.next(true);
1368
+ console.log('file', this.myInput.nativeElement.files[0]);
1369
+ this.filename = this.myInput.nativeElement.files[0].name;
1370
+ this.writeValue(this.captureDataUrl);
1371
+ // if (this.nomeArquivo && this.subir) {
1372
+ // this.arquivoService.setImagem({ Nome: this.nomeArquivo, Conteudo: this.captureDataUrl, Status: 0, Pasta: this.pasta })
1373
+ // .subscribe(result => {
1374
+ // console.log('result set imagem', result);
1375
+ // if (result.Status == 200) {
1376
+ // this.utils.showToast('Sucesso!');
1377
+ // } else {
1378
+ // this.utils.showAlert('Erro. Tente mais tarde.' + result.Conteudo);
1379
+ // }
1380
+ // }, error => {
1381
+ // this.utils.showAlert('Erro. Tente mais tarde.');
1382
+ // })
1383
+ // }
1384
+ }).catch(error => {
1385
+ this.sucessoEvent.next(false);
1386
+ });
1387
+ }
1388
+ }
1389
+ //util
1390
+ getBase64FromFile(file) {
1391
+ return new Promise((resolve, reject) => {
1392
+ const reader = new FileReader();
1393
+ reader.readAsDataURL(file);
1394
+ reader.onload = () => resolve(reader.result);
1395
+ reader.onerror = error => reject(error);
1396
+ });
1397
+ }
1398
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputArquivoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1399
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: InputArquivoComponent, selector: "kb-input-arquivo", inputs: { nomeArquivo: "nomeArquivo", caption: "caption", pasta: "pasta", subir: "subir", callback: "callback", form: "form", showIcon: "showIcon" }, providers: [{
1400
+ provide: NG_VALUE_ACCESSOR,
1401
+ useExisting: InputArquivoComponent,
1402
+ multi: true
1403
+ }], viewQueries: [{ propertyName: "myInput", first: true, predicate: ["inputNome"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div style=\"text-align:center;\">\r\n <ion-button style=\"box-shadow: #4c8dff 0px 3px 3px 0.05px\" fill=\"outline\" size=\"normal\" color=\"primary\" \r\n (click)=\"showImageBrowser()\" expand=\"block\">\r\n <ion-icon *ngIf=\"showIcon\" class=\"ion-padding-end\" src=\"/assets/icon/image_primary_24dp.svg\"></ion-icon>\r\n {{ caption }}\r\n </ion-button>\r\n <input type=\"file\" id=\"upimgfile\" name=\"uploadfile\" #inputNome accept=\"image/*\" (change)=\"loadImagem()\"\r\n style=\"display: none;\" />\r\n </div>\r\n ", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }] }); }
1404
+ }
1405
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: InputArquivoComponent, decorators: [{
1406
+ type: Component,
1407
+ args: [{ selector: 'kb-input-arquivo', providers: [{
1408
+ provide: NG_VALUE_ACCESSOR,
1409
+ useExisting: InputArquivoComponent,
1410
+ multi: true
1411
+ }], template: "<div style=\"text-align:center;\">\r\n <ion-button style=\"box-shadow: #4c8dff 0px 3px 3px 0.05px\" fill=\"outline\" size=\"normal\" color=\"primary\" \r\n (click)=\"showImageBrowser()\" expand=\"block\">\r\n <ion-icon *ngIf=\"showIcon\" class=\"ion-padding-end\" src=\"/assets/icon/image_primary_24dp.svg\"></ion-icon>\r\n {{ caption }}\r\n </ion-button>\r\n <input type=\"file\" id=\"upimgfile\" name=\"uploadfile\" #inputNome accept=\"image/*\" (change)=\"loadImagem()\"\r\n style=\"display: none;\" />\r\n </div>\r\n " }]
1412
+ }], ctorParameters: () => [], propDecorators: { nomeArquivo: [{
1413
+ type: Input
1414
+ }], caption: [{
1415
+ type: Input
1416
+ }], pasta: [{
1417
+ type: Input
1418
+ }], subir: [{
1419
+ type: Input
1420
+ }], callback: [{
1421
+ type: Input
1422
+ }], form: [{
1423
+ type: Input
1424
+ }], showIcon: [{
1425
+ type: Input
1426
+ }], myInput: [{
1427
+ type: ViewChild,
1428
+ args: ['inputNome', { read: ElementRef, static: true }]
1429
+ }] } });
1430
+
1431
+ const LibConfigService = new InjectionToken('LibConfig');
1432
+ class AppprojectComponentsModule {
1433
+ static forRoot(config) {
1434
+ return {
1435
+ ngModule: AppprojectComponentsModule,
1436
+ providers: [
1437
+ AppprojectComponentsService,
1438
+ {
1439
+ provide: LibConfigService,
1440
+ useValue: config
1441
+ }
1442
+ ]
1443
+ };
1444
+ }
1445
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1446
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsModule, declarations: [AppprojectComponentsComponent,
1447
+ InputTextComponent,
1448
+ InputFormatComponent,
1449
+ InputSelectComponent,
1450
+ InputPesquisaComponent,
1451
+ ModelTreeviewComponent,
1452
+ InputValorComponent,
1453
+ InputAreaComponent,
1454
+ InputCepComponent,
1455
+ InputArquivoComponent], imports: [CommonModule,
1456
+ HttpClientModule,
1457
+ IonicModule,
1458
+ ReactiveFormsModule], exports: [AppprojectComponentsComponent,
1459
+ InputTextComponent,
1460
+ InputFormatComponent,
1461
+ InputSelectComponent,
1462
+ InputPesquisaComponent,
1463
+ ModelTreeviewComponent,
1464
+ InputValorComponent,
1465
+ InputAreaComponent,
1466
+ InputCepComponent,
1467
+ InputArquivoComponent] }); }
1468
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsModule, imports: [CommonModule,
1469
+ HttpClientModule,
1470
+ IonicModule,
1471
+ ReactiveFormsModule] }); }
1472
+ }
1473
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsModule, decorators: [{
1474
+ type: NgModule,
1475
+ args: [{
1476
+ declarations: [
1477
+ AppprojectComponentsComponent,
1478
+ InputTextComponent,
1479
+ InputFormatComponent,
1480
+ InputSelectComponent,
1481
+ InputPesquisaComponent,
1482
+ ModelTreeviewComponent,
1483
+ InputValorComponent,
1484
+ InputAreaComponent,
1485
+ InputCepComponent,
1486
+ InputArquivoComponent
1487
+ ],
1488
+ imports: [
1489
+ CommonModule,
1490
+ HttpClientModule,
1491
+ IonicModule,
1492
+ ReactiveFormsModule
1493
+ ],
1494
+ exports: [
1495
+ AppprojectComponentsComponent,
1496
+ InputTextComponent,
1497
+ InputFormatComponent,
1498
+ InputSelectComponent,
1499
+ InputPesquisaComponent,
1500
+ ModelTreeviewComponent,
1501
+ InputValorComponent,
1502
+ InputAreaComponent,
1503
+ InputCepComponent,
1504
+ InputArquivoComponent
1505
+ ],
1506
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
1507
+ }]
1508
+ }] });
1509
+
1510
+ /*
1511
+ * Public API Surface of appproject-components
1512
+ */
1513
+
1514
+ /**
1515
+ * Generated bundle index. Do not edit.
1516
+ */
1517
+
1518
+ export { AppprojectComponentsComponent, AppprojectComponentsModule, AppprojectComponentsService, BaseInputComponent, InputAreaComponent, InputArquivoComponent, InputCepComponent, InputFormatComponent, InputPesquisaComponent, InputSelectComponent, InputTextComponent, InputValorComponent, LibConfigService, ModelTreeviewComponent };
1519
+ //# sourceMappingURL=appproject-components.mjs.map