appproject-components 1.0.46 → 1.0.47
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.
- package/karma.conf.js +44 -0
- package/ng-package.json +7 -0
- package/package.json +15 -26
- package/src/lib/appproject-components.component.spec.ts +23 -0
- package/src/lib/appproject-components.component.ts +20 -0
- package/src/lib/appproject-components.module.ts +106 -0
- package/src/lib/appproject-components.service.spec.ts +16 -0
- package/src/lib/appproject-components.service.ts +9 -0
- package/src/lib/baseComponent.scss +162 -0
- package/src/lib/baseInputComponent.ts +35 -0
- package/src/lib/buttons/baseBtnComponent.ts +38 -0
- package/src/lib/buttons/btn-action/btn-action.component.html +11 -0
- package/src/lib/buttons/btn-action/btn-action.component.scss +7 -0
- package/src/lib/buttons/btn-action/btn-action.component.spec.ts +24 -0
- package/src/lib/buttons/btn-action/btn-action.component.ts +31 -0
- package/src/lib/buttons/btn-cancelar/btn-cancelar.component.html +14 -0
- package/src/lib/buttons/btn-cancelar/btn-cancelar.component.scss +5 -0
- package/src/lib/buttons/btn-cancelar/btn-cancelar.component.spec.ts +24 -0
- package/src/lib/buttons/btn-cancelar/btn-cancelar.component.ts +19 -0
- package/src/lib/buttons/btn-excluir/btn-excluir.component.html +6 -0
- package/src/lib/buttons/btn-excluir/btn-excluir.component.scss +5 -0
- package/src/lib/buttons/btn-excluir/btn-excluir.component.spec.ts +24 -0
- package/src/lib/buttons/btn-excluir/btn-excluir.component.ts +18 -0
- package/src/lib/buttons/btn-novo/btn-novo.component.html +14 -0
- package/src/lib/buttons/btn-novo/btn-novo.component.scss +8 -0
- package/src/lib/buttons/btn-novo/btn-novo.component.spec.ts +24 -0
- package/src/lib/buttons/btn-novo/btn-novo.component.ts +20 -0
- package/src/lib/buttons/btn-salvar/btn-salvar.component.html +8 -0
- package/src/lib/buttons/btn-salvar/btn-salvar.component.scss +5 -0
- package/src/lib/buttons/btn-salvar/btn-salvar.component.spec.ts +24 -0
- package/src/lib/buttons/btn-salvar/btn-salvar.component.ts +16 -0
- package/src/lib/entity-edit/entity-edit.component.html +143 -0
- package/src/lib/entity-edit/entity-edit.component.scss +4 -0
- package/src/lib/entity-edit/entity-edit.component.spec.ts +23 -0
- package/src/lib/entity-edit/entity-edit.component.ts +43 -0
- package/src/lib/grid-view/grid-view.component.html +116 -0
- package/src/lib/grid-view/grid-view.component.scss +47 -0
- package/src/lib/grid-view/grid-view.component.spec.ts +23 -0
- package/src/lib/grid-view/grid-view.component.ts +292 -0
- package/src/lib/input-area/input-area.component.html +30 -0
- package/src/lib/input-area/input-area.component.scss +68 -0
- package/src/lib/input-area/input-area.component.spec.ts +23 -0
- package/src/lib/input-area/input-area.component.ts +69 -0
- package/src/lib/input-arquivo/input-arquivo.component.html +11 -0
- package/src/lib/input-arquivo/input-arquivo.component.scss +0 -0
- package/src/lib/input-arquivo/input-arquivo.component.spec.ts +23 -0
- package/src/lib/input-arquivo/input-arquivo.component.ts +140 -0
- package/src/lib/input-cep/input-cep.component.html +38 -0
- package/src/lib/input-cep/input-cep.component.scss +0 -0
- package/src/lib/input-cep/input-cep.component.spec.ts +23 -0
- package/src/lib/input-cep/input-cep.component.ts +186 -0
- package/src/lib/input-checkbox/input-checkbox.component.html +12 -0
- package/src/lib/input-checkbox/input-checkbox.component.scss +11 -0
- package/src/lib/input-checkbox/input-checkbox.component.spec.ts +23 -0
- package/src/lib/input-checkbox/input-checkbox.component.ts +48 -0
- package/src/lib/input-format/input-format.component.html +32 -0
- package/src/lib/input-format/input-format.component.scss +47 -0
- package/src/lib/input-format/input-format.component.spec.ts +23 -0
- package/src/lib/input-format/input-format.component.ts +139 -0
- package/src/lib/input-pesquisa/input-pesquisa.component.html +77 -0
- package/src/lib/input-pesquisa/input-pesquisa.component.scss +127 -0
- package/src/lib/input-pesquisa/input-pesquisa.component.spec.ts +23 -0
- package/src/lib/input-pesquisa/input-pesquisa.component.ts +558 -0
- package/src/lib/input-radio/input-radio.component.html +21 -0
- package/src/lib/input-radio/input-radio.component.scss +3 -0
- package/src/lib/input-radio/input-radio.component.spec.ts +23 -0
- package/src/lib/input-radio/input-radio.component.ts +49 -0
- package/src/lib/input-select/input-select.component.html +29 -0
- package/src/lib/input-select/input-select.component.scss +62 -0
- package/src/lib/input-select/input-select.component.spec.ts +23 -0
- package/src/lib/input-select/input-select.component.ts +96 -0
- package/src/lib/input-text/input-text.component.html +48 -0
- package/src/lib/input-text/input-text.component.scss +63 -0
- package/src/lib/input-text/input-text.component.spec.ts +23 -0
- package/src/lib/input-text/input-text.component.ts +78 -0
- package/src/lib/input-valor/input-valor.component.html +32 -0
- package/src/lib/input-valor/input-valor.component.scss +47 -0
- package/src/lib/input-valor/input-valor.component.spec.ts +23 -0
- package/src/lib/input-valor/input-valor.component.ts +164 -0
- package/{lib/lib-config.d.ts → src/lib/lib-config.ts} +4 -3
- package/src/lib/model-treeview/model-treeview.component.html +20 -0
- package/src/lib/model-treeview/model-treeview.component.scss +0 -0
- package/src/lib/model-treeview/model-treeview.component.spec.ts +23 -0
- package/src/lib/model-treeview/model-treeview.component.ts +152 -0
- package/src/lib/tree-view/tree-view.component.html +96 -0
- package/src/lib/tree-view/tree-view.component.scss +50 -0
- package/src/lib/tree-view/tree-view.component.spec.ts +23 -0
- package/src/lib/tree-view/tree-view.component.ts +92 -0
- package/src/lib/tree-view-nivel/tree-view-nivel.component.html +17 -0
- package/src/lib/tree-view-nivel/tree-view-nivel.component.scss +8 -0
- package/src/lib/tree-view-nivel/tree-view-nivel.component.spec.ts +23 -0
- package/src/lib/tree-view-nivel/tree-view-nivel.component.ts +43 -0
- package/{public-api.d.ts → src/public-api.ts} +30 -24
- package/src/test.ts +15 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/esm2022/appproject-components.mjs +0 -5
- package/esm2022/lib/appproject-components.component.mjs +0 -22
- package/esm2022/lib/appproject-components.module.mjs +0 -159
- package/esm2022/lib/appproject-components.service.mjs +0 -14
- package/esm2022/lib/baseInputComponent.mjs +0 -69
- package/esm2022/lib/buttons/baseBtnComponent.mjs +0 -63
- package/esm2022/lib/buttons/btn-action/btn-action.component.mjs +0 -55
- package/esm2022/lib/buttons/btn-cancelar/btn-cancelar.component.mjs +0 -25
- package/esm2022/lib/buttons/btn-excluir/btn-excluir.component.mjs +0 -29
- package/esm2022/lib/buttons/btn-novo/btn-novo.component.mjs +0 -33
- package/esm2022/lib/buttons/btn-salvar/btn-salvar.component.mjs +0 -19
- package/esm2022/lib/entity-edit/entity-edit.component.mjs +0 -53
- package/esm2022/lib/grid-view/grid-view.component.mjs +0 -275
- package/esm2022/lib/input-area/input-area.component.mjs +0 -72
- package/esm2022/lib/input-arquivo/input-arquivo.component.mjs +0 -154
- package/esm2022/lib/input-cep/input-cep.component.mjs +0 -180
- package/esm2022/lib/input-checkbox/input-checkbox.component.mjs +0 -51
- package/esm2022/lib/input-format/input-format.component.mjs +0 -138
- package/esm2022/lib/input-pesquisa/input-pesquisa.component.mjs +0 -557
- package/esm2022/lib/input-radio/input-radio.component.mjs +0 -58
- package/esm2022/lib/input-select/input-select.component.mjs +0 -110
- package/esm2022/lib/input-text/input-text.component.mjs +0 -88
- package/esm2022/lib/input-valor/input-valor.component.mjs +0 -161
- package/esm2022/lib/lib-config.mjs +0 -2
- package/esm2022/lib/model-treeview/model-treeview.component.mjs +0 -126
- package/esm2022/lib/tree-view/tree-view.component.mjs +0 -104
- package/esm2022/lib/tree-view-nivel/tree-view-nivel.component.mjs +0 -50
- package/esm2022/public-api.mjs +0 -30
- package/fesm2022/appproject-components.mjs +0 -2531
- package/fesm2022/appproject-components.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/appproject-components.component.d.ts +0 -8
- package/lib/appproject-components.module.d.ts +0 -36
- package/lib/appproject-components.service.d.ts +0 -6
- package/lib/baseInputComponent.d.ts +0 -28
- package/lib/buttons/baseBtnComponent.d.ts +0 -19
- package/lib/buttons/btn-action/btn-action.component.d.ts +0 -21
- package/lib/buttons/btn-cancelar/btn-cancelar.component.d.ts +0 -10
- package/lib/buttons/btn-excluir/btn-excluir.component.d.ts +0 -12
- package/lib/buttons/btn-novo/btn-novo.component.d.ts +0 -13
- package/lib/buttons/btn-salvar/btn-salvar.component.d.ts +0 -9
- package/lib/entity-edit/entity-edit.component.d.ts +0 -22
- package/lib/grid-view/grid-view.component.d.ts +0 -52
- package/lib/input-area/input-area.component.d.ts +0 -24
- package/lib/input-arquivo/input-arquivo.component.d.ts +0 -43
- package/lib/input-cep/input-cep.component.d.ts +0 -29
- package/lib/input-checkbox/input-checkbox.component.d.ts +0 -21
- package/lib/input-format/input-format.component.d.ts +0 -27
- package/lib/input-pesquisa/input-pesquisa.component.d.ts +0 -69
- package/lib/input-radio/input-radio.component.d.ts +0 -23
- package/lib/input-select/input-select.component.d.ts +0 -32
- package/lib/input-text/input-text.component.d.ts +0 -33
- package/lib/input-valor/input-valor.component.d.ts +0 -29
- package/lib/model-treeview/model-treeview.component.d.ts +0 -39
- package/lib/tree-view/tree-view.component.d.ts +0 -23
- package/lib/tree-view-nivel/tree-view-nivel.component.d.ts +0 -17
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<ion-item lines="none" style="--background: inherited; --background-focused: transparent; padding-right: 0px;" [class]="itemClass"
|
|
3
|
+
[style.opacity]="readonly ? '0.5' : '1'">
|
|
4
|
+
<ion-radio-group [disabled]="readonly" #inputRadio
|
|
5
|
+
[value]="data"
|
|
6
|
+
(ionChange)="writeValue(inputRadio.value)">
|
|
7
|
+
<span style="font-size: 13px">
|
|
8
|
+
{{ label }}
|
|
9
|
+
</span>
|
|
10
|
+
<ion-row>
|
|
11
|
+
<ion-col *ngFor="let item of itens">
|
|
12
|
+
<ion-radio style="margin-right: 12px;" [color]="color"
|
|
13
|
+
labelPlacement="end"
|
|
14
|
+
justify="start"
|
|
15
|
+
[value]="item[itemId]">
|
|
16
|
+
{{ item[itemNome] }}</ion-radio><br />
|
|
17
|
+
</ion-col>
|
|
18
|
+
</ion-row>
|
|
19
|
+
</ion-radio-group>
|
|
20
|
+
</ion-item>
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { InputRadioComponent } from './input-radio.component';
|
|
4
|
+
|
|
5
|
+
describe('InputRadioComponent', () => {
|
|
6
|
+
let component: InputRadioComponent;
|
|
7
|
+
let fixture: ComponentFixture<InputRadioComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [InputRadioComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(InputRadioComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { BaseInputComponent } from '../baseInputComponent';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'kb-input-radio',
|
|
7
|
+
templateUrl: './input-radio.component.html',
|
|
8
|
+
styleUrls: ['./input-radio.component.scss', './../baseComponent.scss'],
|
|
9
|
+
providers: [{
|
|
10
|
+
provide: NG_VALUE_ACCESSOR,
|
|
11
|
+
useExisting: InputRadioComponent,
|
|
12
|
+
multi: true
|
|
13
|
+
}]
|
|
14
|
+
})
|
|
15
|
+
export class InputRadioComponent extends BaseInputComponent implements OnInit, ControlValueAccessor {
|
|
16
|
+
@Input() itens: any[] = [];
|
|
17
|
+
@Input() itemId: string = "Id";
|
|
18
|
+
@Input() itemNome: string = "Nome";
|
|
19
|
+
@Input() color: string = "primary";
|
|
20
|
+
//control value acessor
|
|
21
|
+
public data!: string | undefined;
|
|
22
|
+
private onChange: Function = (data: string) => { };
|
|
23
|
+
private onTouch: Function = () => { };
|
|
24
|
+
private disabled: boolean = false;
|
|
25
|
+
public console = console;
|
|
26
|
+
|
|
27
|
+
writeValue(value?: any): void {
|
|
28
|
+
//console.log('write value', value);
|
|
29
|
+
this.onChange(value);
|
|
30
|
+
this.data = value;
|
|
31
|
+
}
|
|
32
|
+
registerOnChange(fn: any): void {
|
|
33
|
+
this.onChange = fn;
|
|
34
|
+
}
|
|
35
|
+
registerOnTouched(fn: any): void {
|
|
36
|
+
this.onTouch = fn;
|
|
37
|
+
}
|
|
38
|
+
setDisabledState?(isDisabled: boolean): void {
|
|
39
|
+
this.disabled = this.disabled;
|
|
40
|
+
}
|
|
41
|
+
constructor() {
|
|
42
|
+
super();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
override ngOnInit(): void {
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
<div [formGroup]="form">
|
|
3
|
+
-->
|
|
4
|
+
<div>
|
|
5
|
+
<ion-item lines="none" style="--background: inherited; --background-focused: transparent;" [class]="itemClass" #itemSelect
|
|
6
|
+
[ngClass]="form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' "
|
|
7
|
+
>
|
|
8
|
+
<ion-label *ngIf="label" [position]="labelPosition" class="focus-label">{{ label }}</ion-label>
|
|
9
|
+
<!-- formControlName="{{ formControlName }}" -->
|
|
10
|
+
<select #inputSelect
|
|
11
|
+
style="width: 100%;" (change)="onSelectChange(inputSelect.value)"
|
|
12
|
+
(blur)="onBlur()" (focus)="onEnter()" [disabled]="readonly">
|
|
13
|
+
<option *ngIf="itemNull" [value]="''" selected>{{ opcaoDefault }}</option>
|
|
14
|
+
<option *ngFor="let item of itens" [value]="item[itemId]" [selected]="item[itemId] == data">{{ item[itemNome] }}
|
|
15
|
+
</option>
|
|
16
|
+
</select>
|
|
17
|
+
</ion-item>
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
<div class="validation-errors" *ngIf="form">
|
|
21
|
+
<ng-container *ngFor="let validation of validation_messages">
|
|
22
|
+
<div class="error-message"
|
|
23
|
+
*ngIf="form && form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.touched)">
|
|
24
|
+
• {{ validation.message }}
|
|
25
|
+
</div>
|
|
26
|
+
</ng-container>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
</div>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
ion-label {
|
|
4
|
+
margin-bottom: 4px !important;
|
|
5
|
+
}
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
select {
|
|
9
|
+
padding: var(--select-padding, 4px);
|
|
10
|
+
border: 1px solid darkgray;
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
width: 100%;
|
|
13
|
+
margin-top: 2px;
|
|
14
|
+
height: var(--select-height, 29px);
|
|
15
|
+
margin-left: 0px;
|
|
16
|
+
margin-bottom: 2px;
|
|
17
|
+
background-color: white !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.no-padding {
|
|
21
|
+
--inner-padding-end: 0px; --padding-start: 0px;
|
|
22
|
+
--padding-bottom: 0px;
|
|
23
|
+
--inner-padding-bottom: 0px;
|
|
24
|
+
height: 42px !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
select:focus {
|
|
29
|
+
outline: none !important;
|
|
30
|
+
border: 1px solid lightblue !important;
|
|
31
|
+
ion-label{
|
|
32
|
+
color: var(--ion-color-label-focus, blue) !important;
|
|
33
|
+
}
|
|
34
|
+
/*
|
|
35
|
+
.focus-label {
|
|
36
|
+
color: var(--ion-color-label-focus, blue) !important;
|
|
37
|
+
}
|
|
38
|
+
*/
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
.item-has-focus {
|
|
44
|
+
ion-label {
|
|
45
|
+
color: var(--ion-color-label-focus, blue) !important;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/*
|
|
51
|
+
.no-padding-no-height {
|
|
52
|
+
--inner-padding-end: 0px; --padding-start: 0px;
|
|
53
|
+
--padding-bottom: 0px;
|
|
54
|
+
--inner-padding-bottom: 0px;
|
|
55
|
+
}
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
.padding-top {
|
|
60
|
+
--padding-top: 0px;
|
|
61
|
+
}
|
|
62
|
+
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { InputSelectComponent } from './input-select.component';
|
|
4
|
+
|
|
5
|
+
describe('InputSelectComponent', () => {
|
|
6
|
+
let component: InputSelectComponent;
|
|
7
|
+
let fixture: ComponentFixture<InputSelectComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ InputSelectComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(InputSelectComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, Renderer2, ViewChild } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { BaseInputComponent } from '../baseInputComponent';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'kb-input-select',
|
|
7
|
+
templateUrl: './input-select.component.html',
|
|
8
|
+
styleUrls: ['./input-select.component.scss', './../baseComponent.scss'],
|
|
9
|
+
providers: [{
|
|
10
|
+
provide: NG_VALUE_ACCESSOR,
|
|
11
|
+
useExisting: InputSelectComponent,
|
|
12
|
+
multi: true
|
|
13
|
+
}]
|
|
14
|
+
})
|
|
15
|
+
export class InputSelectComponent extends BaseInputComponent implements OnInit, ControlValueAccessor {
|
|
16
|
+
@Output() selectChange = new EventEmitter();
|
|
17
|
+
@Output() selectChangeEntity = new EventEmitter();
|
|
18
|
+
@Input() itens: any[] = [];
|
|
19
|
+
@Input() itemId: string = "Id";
|
|
20
|
+
@Input() itemNome: string = "Nome";
|
|
21
|
+
@Input() showNovo: boolean = false;
|
|
22
|
+
@Input() itemNull: boolean = true;
|
|
23
|
+
@Input() opcaoDefault: string = 'Selecionar';
|
|
24
|
+
|
|
25
|
+
//para 'injeção' de estilo no foco
|
|
26
|
+
@ViewChild("itemSelect", {read: ElementRef}) itemSelect: any;
|
|
27
|
+
|
|
28
|
+
//control value acessor
|
|
29
|
+
public data: string | any;
|
|
30
|
+
private onChange: Function = (data: string) => {};
|
|
31
|
+
private onTouch: Function = () => {};
|
|
32
|
+
private disabled: boolean = false;
|
|
33
|
+
public console = console;
|
|
34
|
+
|
|
35
|
+
writeValue(value: string | any): void {
|
|
36
|
+
//console.log('write value select', value);
|
|
37
|
+
this.onChange(value);
|
|
38
|
+
this.data = value;
|
|
39
|
+
}
|
|
40
|
+
registerOnChange(fn: any): void {
|
|
41
|
+
this.onChange = fn;
|
|
42
|
+
}
|
|
43
|
+
registerOnTouched(fn: any): void {
|
|
44
|
+
this.onTouch = fn;
|
|
45
|
+
}
|
|
46
|
+
setDisabledState?(isDisabled: boolean): void {
|
|
47
|
+
this.disabled = this.disabled;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
constructor(private renderer: Renderer2) {
|
|
51
|
+
super();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override ngOnInit() {
|
|
55
|
+
if (this.readonly === true) {
|
|
56
|
+
//console.log("disabled");
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
//this.renderer.addClass(document.getElementById("item-select"), "item-has-focus");
|
|
59
|
+
this.renderer.addClass(this.itemSelect.nativeElement, "item-interactive-disabled");
|
|
60
|
+
//console.log('select focused', document.getElementById("item-select"));
|
|
61
|
+
}, 100);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
onSelectChange(value: any) {
|
|
66
|
+
this.writeValue(value == '' ? null : value);
|
|
67
|
+
if (this.selectChange != null) {
|
|
68
|
+
//console.log('emit', value);
|
|
69
|
+
this.selectChange.emit(value);
|
|
70
|
+
}
|
|
71
|
+
if (this.selectChangeEntity != null) {
|
|
72
|
+
const existe = this.itens.find(i => i[this.itemId] == value);
|
|
73
|
+
this.selectChangeEntity.emit(existe);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onBlur() {
|
|
78
|
+
//console.log('input select blur')
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
this.renderer.removeClass(this.itemSelect.nativeElement, "item-has-focus");
|
|
81
|
+
}, 200);
|
|
82
|
+
|
|
83
|
+
if (this.form) {
|
|
84
|
+
this.form.get(this.formControlName)?.markAsTouched();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
onEnter() {
|
|
89
|
+
//adicionar classe ao ion-item
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
this.renderer.addClass(this.itemSelect.nativeElement, "item-has-focus");
|
|
92
|
+
//console.log('select focused', document.getElementById("item-select"));
|
|
93
|
+
}, 200);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
<div [formGroup]="form">
|
|
3
|
+
[style.opacity]="readonly ? '0.8' : '1'"
|
|
4
|
+
-->
|
|
5
|
+
<div>
|
|
6
|
+
<ion-item lines="none" style="--background: inherited; --background-focused: transparent; padding-right: 0px;" [class]="itemClass"
|
|
7
|
+
[ngClass]="form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' "
|
|
8
|
+
>
|
|
9
|
+
<ion-label position="{{ labelPosition }}">{{ label }} </ion-label>
|
|
10
|
+
<!-- formControlName="{{ campo }}" -->
|
|
11
|
+
<ion-input #inputText
|
|
12
|
+
type="{{type}}"
|
|
13
|
+
[placeholder]="placeholder"
|
|
14
|
+
maxlength="{{ max }}"
|
|
15
|
+
(ionBlur)="onBlur()"
|
|
16
|
+
[value]="data"
|
|
17
|
+
(input)="writeValue(inputText.value)"
|
|
18
|
+
autocomplete="new-password"
|
|
19
|
+
[style.--background]="inputBackgroungColor"
|
|
20
|
+
[disabled]="readonly"
|
|
21
|
+
[clearInput]="botaoLimpar">
|
|
22
|
+
<ion-icon *ngIf="iconInput" name="{{ iconInput }}"></ion-icon>
|
|
23
|
+
</ion-input>
|
|
24
|
+
|
|
25
|
+
<ion-button size="small" slot="end" *ngIf="showSeePassword" style="margin-top: 27px; margin-inline-start: 4px !important;" fill="clear" color="dark" (click)="changeTypeOfInput()">
|
|
26
|
+
<!-- (click)="limparClick()" -->
|
|
27
|
+
<ion-icon [name]="type == 'password' ? 'eye-outline' : 'eye-off-outline' "></ion-icon>
|
|
28
|
+
</ion-button>
|
|
29
|
+
|
|
30
|
+
<ion-button size="small" slot="end" *ngIf="showCustomAction" style="margin-top: var(--input-text-custom-btn-margin-top, 27px); margin-inline-start: 4px !important;" fill="clear" color="dark" (click)="customClick()">
|
|
31
|
+
<!-- (click)="limparClick()" -->
|
|
32
|
+
<ion-icon slot="icon-only" [name]="customActionIcon"></ion-icon>
|
|
33
|
+
</ion-button>
|
|
34
|
+
|
|
35
|
+
<span *ngIf="inputSpanAfter" slot="end" class="inputSpanAfter-item"> {{ inputSpanAfter }}</span>
|
|
36
|
+
</ion-item>
|
|
37
|
+
|
|
38
|
+
<div class="validation-errors" *ngIf="form">
|
|
39
|
+
|
|
40
|
+
<ng-container *ngFor="let validation of validation_messages">
|
|
41
|
+
<div class="error-message"
|
|
42
|
+
*ngIf="form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)">
|
|
43
|
+
• {{ validation.message }}
|
|
44
|
+
</div>
|
|
45
|
+
</ng-container>
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
ion-label {
|
|
3
|
+
margin-bottom: 4px !important;
|
|
4
|
+
opacity: 1 !important;
|
|
5
|
+
}
|
|
6
|
+
*/
|
|
7
|
+
.no-padding-end {
|
|
8
|
+
--inner-padding-end: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
ion-input {
|
|
12
|
+
ion-icon {
|
|
13
|
+
padding-right: 6px;
|
|
14
|
+
font-size: 18px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
ion-input {
|
|
20
|
+
padding: 2px;
|
|
21
|
+
border: 1px solid darkgray;
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
width: 100%;
|
|
24
|
+
margin-top: 2px;
|
|
25
|
+
max-height: 29px;
|
|
26
|
+
transition: .2s ease;
|
|
27
|
+
}
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
.padding {
|
|
32
|
+
//--inner-padding-end: auto; --padding-start: auto;
|
|
33
|
+
padding: auto;
|
|
34
|
+
padding-left: 0px;
|
|
35
|
+
}
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
.no-padding {
|
|
40
|
+
--inner-padding-end: 0px; --padding-start: 0px;
|
|
41
|
+
--padding-bottom: 0px;
|
|
42
|
+
--inner-padding-bottom: 0px;
|
|
43
|
+
height: 39px !important;
|
|
44
|
+
}
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/*
|
|
48
|
+
.no-padding-no-height {
|
|
49
|
+
--inner-padding-end: 0px; --padding-start: 0px;
|
|
50
|
+
--padding-bottom: 0px;
|
|
51
|
+
--inner-padding-bottom: 0px;
|
|
52
|
+
}
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
.padding-top {
|
|
57
|
+
--padding-top: 0px;
|
|
58
|
+
}
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
.input-login {
|
|
62
|
+
height: 36px;
|
|
63
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { InputTextComponent } from './input-text.component';
|
|
4
|
+
|
|
5
|
+
describe('InputTextComponent', () => {
|
|
6
|
+
let component: InputTextComponent;
|
|
7
|
+
let fixture: ComponentFixture<InputTextComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ InputTextComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(InputTextComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { BaseInputComponent } from '../baseInputComponent';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'kb-input-text',
|
|
7
|
+
templateUrl: './input-text.component.html',
|
|
8
|
+
styleUrls: ['./input-text.component.scss', './../baseComponent.scss'],
|
|
9
|
+
providers: [{
|
|
10
|
+
provide: NG_VALUE_ACCESSOR,
|
|
11
|
+
useExisting: InputTextComponent,
|
|
12
|
+
multi: true
|
|
13
|
+
}]
|
|
14
|
+
})
|
|
15
|
+
export class InputTextComponent extends BaseInputComponent implements OnInit, ControlValueAccessor {
|
|
16
|
+
@Input() iconInput?: string;
|
|
17
|
+
@Input() inputSpanAfter: string = null;
|
|
18
|
+
@ViewChild('inputText', { read: ElementRef, static: true}) inputTextEdit;
|
|
19
|
+
@Input() campoFoco: string;
|
|
20
|
+
showSeePassword!: boolean;
|
|
21
|
+
@Input() showCustomAction: boolean = false;
|
|
22
|
+
@Input() customActionIcon: string = "search-outline";
|
|
23
|
+
@Output() customActionClick = new EventEmitter();
|
|
24
|
+
//control value acessor
|
|
25
|
+
public data!: string | undefined;
|
|
26
|
+
private onChange: Function = (data: string) => {};
|
|
27
|
+
private onTouch: Function = () => {};
|
|
28
|
+
private disabled: boolean = false;
|
|
29
|
+
public console = console;
|
|
30
|
+
|
|
31
|
+
writeValue(value?: any): void {
|
|
32
|
+
//console.log('write value', value);
|
|
33
|
+
this.onChange(value);
|
|
34
|
+
this.data = value;
|
|
35
|
+
}
|
|
36
|
+
registerOnChange(fn: any): void {
|
|
37
|
+
this.onChange = fn;
|
|
38
|
+
}
|
|
39
|
+
registerOnTouched(fn: any): void {
|
|
40
|
+
this.onTouch = fn;
|
|
41
|
+
}
|
|
42
|
+
setDisabledState?(isDisabled: boolean): void {
|
|
43
|
+
this.disabled = this.disabled;
|
|
44
|
+
}
|
|
45
|
+
constructor() {
|
|
46
|
+
super();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
override ngOnInit(): void {
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
onBlur() {
|
|
53
|
+
console.log('control name', this.formControlName);
|
|
54
|
+
if (this.form) {
|
|
55
|
+
this.form.get(this.formControlName)?.markAsTouched();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
limparClick() {
|
|
60
|
+
this.writeValue(undefined);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
isReadonly() {
|
|
64
|
+
return this.leitura;
|
|
65
|
+
}
|
|
66
|
+
changeTypeOfInput() {
|
|
67
|
+
this.type =
|
|
68
|
+
this.type == 'password' ?
|
|
69
|
+
'text' : 'password';
|
|
70
|
+
}
|
|
71
|
+
setFocus() {
|
|
72
|
+
this.inputTextEdit.nativeElement.setFocus();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
customClick() {
|
|
76
|
+
this.customActionClick.emit();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
<div [formGroup]="form">
|
|
3
|
+
-->
|
|
4
|
+
<div>
|
|
5
|
+
<ion-item lines="none" style="--background-focused: transparent;" [class]="itemClass"
|
|
6
|
+
[ngClass]="form?.get(formControlName)?.errors && (form?.get(formControlName)?.dirty || form?.get(formControlName)?.touched) ? 'error-shake' : '' "
|
|
7
|
+
>
|
|
8
|
+
<ion-label position="{{ labelPosition }}">{{ label }}</ion-label>
|
|
9
|
+
<!-- formControlName="{{ formControlName }}" -->
|
|
10
|
+
<ion-input #inputValor
|
|
11
|
+
type="text"
|
|
12
|
+
[placeholder]="placeholder"
|
|
13
|
+
maxlength="{{ max }}"
|
|
14
|
+
(ionBlur)="onBlur()"
|
|
15
|
+
[value]="data"
|
|
16
|
+
(input)="writeValue(inputValor.value)"
|
|
17
|
+
(keypress)="digitarValor($event)"
|
|
18
|
+
[clearInput]="botaoLimpar"
|
|
19
|
+
[disabled]="readonly"></ion-input>
|
|
20
|
+
</ion-item>
|
|
21
|
+
|
|
22
|
+
<div class="validation-errors" *ngIf="form">
|
|
23
|
+
|
|
24
|
+
<ng-container *ngFor="let validation of validation_messages">
|
|
25
|
+
<div class="error-message"
|
|
26
|
+
*ngIf="form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)">
|
|
27
|
+
• {{ validation.message }}
|
|
28
|
+
</div>
|
|
29
|
+
</ng-container>
|
|
30
|
+
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
ion-label {
|
|
3
|
+
margin-bottom: 4px !important;
|
|
4
|
+
opacity: 1 !important;
|
|
5
|
+
overflow: initial !important;
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
ion-input {
|
|
11
|
+
padding: 4px;
|
|
12
|
+
border: 1px solid darkgray;
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
width: 100%;
|
|
15
|
+
max-height: 27px;
|
|
16
|
+
text-align: right;
|
|
17
|
+
}
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
.item-inner {
|
|
21
|
+
padding-right: 0px !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
.no-padding {
|
|
26
|
+
--inner-padding-end: 0px; --padding-start: 0px;
|
|
27
|
+
--padding-bottom: 0px;
|
|
28
|
+
--inner-padding-bottom: 0px;
|
|
29
|
+
height: 39px !important;
|
|
30
|
+
}
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
.label-right {
|
|
34
|
+
ion-label{
|
|
35
|
+
transform-origin: right top;
|
|
36
|
+
align-self: flex-end;
|
|
37
|
+
//margin-bottom: 4% !important;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.align-to-right {
|
|
42
|
+
ion-label {
|
|
43
|
+
position: relative;
|
|
44
|
+
left: 25%;
|
|
45
|
+
text-align: end;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { InputValorComponent } from './input-valor.component';
|
|
4
|
+
|
|
5
|
+
describe('InputValorComponent', () => {
|
|
6
|
+
let component: InputValorComponent;
|
|
7
|
+
let fixture: ComponentFixture<InputValorComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ InputValorComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(InputValorComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|