appproject-components 1.0.47 → 1.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/appproject-components.mjs +5 -0
- package/esm2022/lib/appproject-components.component.mjs +22 -0
- package/esm2022/lib/appproject-components.module.mjs +159 -0
- package/esm2022/lib/appproject-components.service.mjs +14 -0
- package/esm2022/lib/baseInputComponent.mjs +69 -0
- package/esm2022/lib/buttons/baseBtnComponent.mjs +63 -0
- package/esm2022/lib/buttons/btn-action/btn-action.component.mjs +55 -0
- package/esm2022/lib/buttons/btn-cancelar/btn-cancelar.component.mjs +25 -0
- package/esm2022/lib/buttons/btn-excluir/btn-excluir.component.mjs +29 -0
- package/esm2022/lib/buttons/btn-novo/btn-novo.component.mjs +33 -0
- package/esm2022/lib/buttons/btn-salvar/btn-salvar.component.mjs +19 -0
- package/esm2022/lib/entity-edit/entity-edit.component.mjs +53 -0
- package/esm2022/lib/grid-view/grid-view.component.mjs +275 -0
- package/esm2022/lib/input-area/input-area.component.mjs +72 -0
- package/esm2022/lib/input-arquivo/input-arquivo.component.mjs +154 -0
- package/esm2022/lib/input-cep/input-cep.component.mjs +180 -0
- package/esm2022/lib/input-checkbox/input-checkbox.component.mjs +51 -0
- package/esm2022/lib/input-format/input-format.component.mjs +138 -0
- package/esm2022/lib/input-pesquisa/input-pesquisa.component.mjs +557 -0
- package/esm2022/lib/input-radio/input-radio.component.mjs +58 -0
- package/esm2022/lib/input-select/input-select.component.mjs +110 -0
- package/esm2022/lib/input-text/input-text.component.mjs +88 -0
- package/esm2022/lib/input-valor/input-valor.component.mjs +161 -0
- package/esm2022/lib/lib-config.mjs +2 -0
- package/esm2022/lib/model-treeview/model-treeview.component.mjs +126 -0
- package/esm2022/lib/tree-view/tree-view.component.mjs +104 -0
- package/esm2022/lib/tree-view-nivel/tree-view-nivel.component.mjs +50 -0
- package/esm2022/public-api.mjs +30 -0
- package/fesm2022/appproject-components.mjs +2531 -0
- package/fesm2022/appproject-components.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/appproject-components.component.d.ts +8 -0
- package/lib/appproject-components.module.d.ts +36 -0
- package/lib/appproject-components.service.d.ts +6 -0
- package/lib/baseInputComponent.d.ts +28 -0
- package/lib/buttons/baseBtnComponent.d.ts +19 -0
- package/lib/buttons/btn-action/btn-action.component.d.ts +21 -0
- package/lib/buttons/btn-cancelar/btn-cancelar.component.d.ts +10 -0
- package/lib/buttons/btn-excluir/btn-excluir.component.d.ts +12 -0
- package/lib/buttons/btn-novo/btn-novo.component.d.ts +13 -0
- package/lib/buttons/btn-salvar/btn-salvar.component.d.ts +9 -0
- package/lib/entity-edit/entity-edit.component.d.ts +22 -0
- package/lib/grid-view/grid-view.component.d.ts +52 -0
- package/lib/input-area/input-area.component.d.ts +24 -0
- package/lib/input-arquivo/input-arquivo.component.d.ts +43 -0
- package/lib/input-cep/input-cep.component.d.ts +29 -0
- package/lib/input-checkbox/input-checkbox.component.d.ts +21 -0
- package/lib/input-format/input-format.component.d.ts +27 -0
- package/lib/input-pesquisa/input-pesquisa.component.d.ts +69 -0
- package/lib/input-radio/input-radio.component.d.ts +23 -0
- package/lib/input-select/input-select.component.d.ts +32 -0
- package/lib/input-text/input-text.component.d.ts +33 -0
- package/lib/input-valor/input-valor.component.d.ts +29 -0
- package/{src/lib/lib-config.ts → lib/lib-config.d.ts} +3 -4
- package/lib/model-treeview/model-treeview.component.d.ts +39 -0
- package/lib/tree-view/tree-view.component.d.ts +23 -0
- package/lib/tree-view-nivel/tree-view-nivel.component.d.ts +17 -0
- package/package.json +26 -15
- package/{src/public-api.ts → public-api.d.ts} +24 -30
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/src/lib/appproject-components.component.spec.ts +0 -23
- package/src/lib/appproject-components.component.ts +0 -20
- package/src/lib/appproject-components.module.ts +0 -106
- package/src/lib/appproject-components.service.spec.ts +0 -16
- package/src/lib/appproject-components.service.ts +0 -9
- package/src/lib/baseComponent.scss +0 -162
- package/src/lib/baseInputComponent.ts +0 -35
- package/src/lib/buttons/baseBtnComponent.ts +0 -38
- package/src/lib/buttons/btn-action/btn-action.component.html +0 -11
- package/src/lib/buttons/btn-action/btn-action.component.scss +0 -7
- package/src/lib/buttons/btn-action/btn-action.component.spec.ts +0 -24
- package/src/lib/buttons/btn-action/btn-action.component.ts +0 -31
- package/src/lib/buttons/btn-cancelar/btn-cancelar.component.html +0 -14
- package/src/lib/buttons/btn-cancelar/btn-cancelar.component.scss +0 -5
- package/src/lib/buttons/btn-cancelar/btn-cancelar.component.spec.ts +0 -24
- package/src/lib/buttons/btn-cancelar/btn-cancelar.component.ts +0 -19
- package/src/lib/buttons/btn-excluir/btn-excluir.component.html +0 -6
- package/src/lib/buttons/btn-excluir/btn-excluir.component.scss +0 -5
- package/src/lib/buttons/btn-excluir/btn-excluir.component.spec.ts +0 -24
- package/src/lib/buttons/btn-excluir/btn-excluir.component.ts +0 -18
- package/src/lib/buttons/btn-novo/btn-novo.component.html +0 -14
- package/src/lib/buttons/btn-novo/btn-novo.component.scss +0 -8
- package/src/lib/buttons/btn-novo/btn-novo.component.spec.ts +0 -24
- package/src/lib/buttons/btn-novo/btn-novo.component.ts +0 -20
- package/src/lib/buttons/btn-salvar/btn-salvar.component.html +0 -8
- package/src/lib/buttons/btn-salvar/btn-salvar.component.scss +0 -5
- package/src/lib/buttons/btn-salvar/btn-salvar.component.spec.ts +0 -24
- package/src/lib/buttons/btn-salvar/btn-salvar.component.ts +0 -16
- package/src/lib/entity-edit/entity-edit.component.html +0 -143
- package/src/lib/entity-edit/entity-edit.component.scss +0 -4
- package/src/lib/entity-edit/entity-edit.component.spec.ts +0 -23
- package/src/lib/entity-edit/entity-edit.component.ts +0 -43
- package/src/lib/grid-view/grid-view.component.html +0 -116
- package/src/lib/grid-view/grid-view.component.scss +0 -47
- package/src/lib/grid-view/grid-view.component.spec.ts +0 -23
- package/src/lib/grid-view/grid-view.component.ts +0 -292
- package/src/lib/input-area/input-area.component.html +0 -30
- package/src/lib/input-area/input-area.component.scss +0 -68
- package/src/lib/input-area/input-area.component.spec.ts +0 -23
- package/src/lib/input-area/input-area.component.ts +0 -69
- package/src/lib/input-arquivo/input-arquivo.component.html +0 -11
- package/src/lib/input-arquivo/input-arquivo.component.scss +0 -0
- package/src/lib/input-arquivo/input-arquivo.component.spec.ts +0 -23
- package/src/lib/input-arquivo/input-arquivo.component.ts +0 -140
- package/src/lib/input-cep/input-cep.component.html +0 -38
- package/src/lib/input-cep/input-cep.component.scss +0 -0
- package/src/lib/input-cep/input-cep.component.spec.ts +0 -23
- package/src/lib/input-cep/input-cep.component.ts +0 -186
- package/src/lib/input-checkbox/input-checkbox.component.html +0 -12
- package/src/lib/input-checkbox/input-checkbox.component.scss +0 -11
- package/src/lib/input-checkbox/input-checkbox.component.spec.ts +0 -23
- package/src/lib/input-checkbox/input-checkbox.component.ts +0 -48
- package/src/lib/input-format/input-format.component.html +0 -32
- package/src/lib/input-format/input-format.component.scss +0 -47
- package/src/lib/input-format/input-format.component.spec.ts +0 -23
- package/src/lib/input-format/input-format.component.ts +0 -139
- package/src/lib/input-pesquisa/input-pesquisa.component.html +0 -77
- package/src/lib/input-pesquisa/input-pesquisa.component.scss +0 -127
- package/src/lib/input-pesquisa/input-pesquisa.component.spec.ts +0 -23
- package/src/lib/input-pesquisa/input-pesquisa.component.ts +0 -558
- package/src/lib/input-radio/input-radio.component.html +0 -21
- package/src/lib/input-radio/input-radio.component.scss +0 -3
- package/src/lib/input-radio/input-radio.component.spec.ts +0 -23
- package/src/lib/input-radio/input-radio.component.ts +0 -49
- package/src/lib/input-select/input-select.component.html +0 -29
- package/src/lib/input-select/input-select.component.scss +0 -62
- package/src/lib/input-select/input-select.component.spec.ts +0 -23
- package/src/lib/input-select/input-select.component.ts +0 -96
- package/src/lib/input-text/input-text.component.html +0 -48
- package/src/lib/input-text/input-text.component.scss +0 -63
- package/src/lib/input-text/input-text.component.spec.ts +0 -23
- package/src/lib/input-text/input-text.component.ts +0 -78
- package/src/lib/input-valor/input-valor.component.html +0 -32
- package/src/lib/input-valor/input-valor.component.scss +0 -47
- package/src/lib/input-valor/input-valor.component.spec.ts +0 -23
- package/src/lib/input-valor/input-valor.component.ts +0 -164
- package/src/lib/model-treeview/model-treeview.component.html +0 -20
- package/src/lib/model-treeview/model-treeview.component.scss +0 -0
- package/src/lib/model-treeview/model-treeview.component.spec.ts +0 -23
- package/src/lib/model-treeview/model-treeview.component.ts +0 -152
- package/src/lib/tree-view/tree-view.component.html +0 -96
- package/src/lib/tree-view/tree-view.component.scss +0 -50
- package/src/lib/tree-view/tree-view.component.spec.ts +0 -23
- package/src/lib/tree-view/tree-view.component.ts +0 -92
- package/src/lib/tree-view-nivel/tree-view-nivel.component.html +0 -17
- package/src/lib/tree-view-nivel/tree-view-nivel.component.scss +0 -8
- package/src/lib/tree-view-nivel/tree-view-nivel.component.spec.ts +0 -23
- package/src/lib/tree-view-nivel/tree-view-nivel.component.ts +0 -43
- package/src/test.ts +0 -15
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
.grid {
|
|
2
|
-
width: 100%;
|
|
3
|
-
|
|
4
|
-
thead {
|
|
5
|
-
td {
|
|
6
|
-
border: 1px solid gray;
|
|
7
|
-
padding: 4px 4px;
|
|
8
|
-
color: black !important;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
tbody {
|
|
13
|
-
td {
|
|
14
|
-
border: 1px solid gray;
|
|
15
|
-
padding: 2px 4px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
tr {
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
|
|
21
|
-
&:hover {
|
|
22
|
-
background-color: rgb(105, 156, 204, 0.5);
|
|
23
|
-
transition-duration: .5s;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
tr.item-selecionado {
|
|
28
|
-
background-color: rgb(105, 156, 204, 0.2);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
[hidden] {
|
|
34
|
-
display: none !important;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/*
|
|
38
|
-
td {
|
|
39
|
-
border: 1px solid, lightgray;
|
|
40
|
-
padding: 2px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.col {
|
|
44
|
-
border: 1px solid gray;
|
|
45
|
-
padding: 2px;
|
|
46
|
-
}
|
|
47
|
-
*/
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { GridViewComponent } from './grid-view.component';
|
|
4
|
-
|
|
5
|
-
describe('GridViewComponent', () => {
|
|
6
|
-
let component: GridViewComponent;
|
|
7
|
-
let fixture: ComponentFixture<GridViewComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [GridViewComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(GridViewComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
|
2
|
-
import { GridColuna, GridTabela, LibService } from 'appproject-lib';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'kb-grid-view',
|
|
6
|
-
templateUrl: './grid-view.component.html',
|
|
7
|
-
styleUrl: './grid-view.component.scss'
|
|
8
|
-
})
|
|
9
|
-
export class GridViewComponent implements OnInit, OnChanges {
|
|
10
|
-
@Input() empresaId: number;
|
|
11
|
-
@Input() tabelaCampos: GridTabela;
|
|
12
|
-
@Input() dataSet: Array<any>;
|
|
13
|
-
@Input() minHeight: string = '400px';
|
|
14
|
-
@Input() inMemoryPagination: boolean = false;
|
|
15
|
-
|
|
16
|
-
@Output() selecionarItem = new EventEmitter();
|
|
17
|
-
@Output() excluirItem = new EventEmitter();
|
|
18
|
-
@Output() selecionarChecked = new EventEmitter();
|
|
19
|
-
|
|
20
|
-
selectedItem: any;
|
|
21
|
-
//inputs = inject(new InjectionToken<any>('title inputs'));
|
|
22
|
-
grupos: any[] = [{ Coluna: '', Tabela: null, Dados: null, Nivel: 0 }];
|
|
23
|
-
|
|
24
|
-
// tabelaCampos = {
|
|
25
|
-
// Selecionar: false,
|
|
26
|
-
// Exportar: true,
|
|
27
|
-
// Colunas: [
|
|
28
|
-
// { Campo: 'Id', Titulo: 'Id', Tamanho: '10%', Ordem: true, Grupo: false, Filtrar: true, OrdemStatus: 0, Tipo: 'number', Valores: [], FiltroOperador: '=', FiltroValor: '', FiltroVisivel: false },
|
|
29
|
-
// { Campo: 'Marca', Titulo: 'Marca', Tamanho: '25%', Ordem: true, Grupo: true, Filtrar: true, OrdemStatus: 0, Tipo: 'string', Valores: [], FiltroOperador: '=', FiltroValor: '', FiltroVisivel: false },
|
|
30
|
-
// { Campo: 'Descricao', Titulo: 'Descrição', Tamanho: '25%', Ordem: true, Grupo: true, Filtrar: true, OrdemStatus: 0, Tipo: 'string', Valores: [], FiltroOperador: '=', FiltroValor: '', FiltroVisivel: false },
|
|
31
|
-
// { Campo: 'Data', Titulo: 'Data', Tamanho: '20%', Ordem: true, Grupo: true, Filtrar: true, OrdemStatus: 0, Tipo: 'date', Valores: [], FiltroOperador: '=', FiltroValor: '', FiltroVisivel: false },
|
|
32
|
-
// { Campo: 'Valor', Titulo: 'Valor', Tamanho: '20%', Ordem: true, Grupo: false, Filtrar: true, OrdemStatus: 0, Tipo: 'number', Valores: [], FiltroOperador: '=', FiltroValor: '', FiltroVisivel: false },
|
|
33
|
-
// ]
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
// dataSet: Array<any> = [
|
|
37
|
-
// { Id: 1, Marca: 'Apple', Descricao: 'IPhone 14', Data: '2023-05-01', Valor: 7899.99 },
|
|
38
|
-
// { Id: 2, Marca: 'Apple', Descricao: 'MacBook Pro', Data: '2023-06-01', Valor: 17999.99 },
|
|
39
|
-
// { Id: 3, Marca: 'Samsung', Descricao: 'Galaxy S23', Data: '2023-05-01', Valor: 6899.99 },
|
|
40
|
-
// { Id: 4, Marca: 'Sony', Descricao: 'PS 5', Data: '2023-06-01', Valor: 4899.99 },
|
|
41
|
-
// { Id: 5, Marca: 'Samsung', Descricao: 'Watch 23', Data: '2023-05-01', Valor: 1899.99 },
|
|
42
|
-
// ]
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
groups = []
|
|
47
|
-
@Input() filteredDataSet = [];
|
|
48
|
-
pageDataSet = [];
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
//array com os campos filtrados para display
|
|
52
|
-
camposDisplay = [];
|
|
53
|
-
|
|
54
|
-
//filtro
|
|
55
|
-
isFiltroOpen: boolean = false;
|
|
56
|
-
selectedColuna: any;
|
|
57
|
-
todosSelecionados: boolean = false;
|
|
58
|
-
|
|
59
|
-
//pagination
|
|
60
|
-
//página atual
|
|
61
|
-
page: number = 1;
|
|
62
|
-
//registros por página
|
|
63
|
-
@Input() pageOffset: number = 20;
|
|
64
|
-
//total de registros
|
|
65
|
-
totalRec: number;
|
|
66
|
-
//total de páginas
|
|
67
|
-
totalPages: number;
|
|
68
|
-
//indexador de paginas
|
|
69
|
-
pages: number[];
|
|
70
|
-
start: number;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
constructor() { }
|
|
74
|
-
|
|
75
|
-
valoresFiltro() {
|
|
76
|
-
this.tabelaCampos.Colunas.forEach(c => {
|
|
77
|
-
if (c.Filtrar) {
|
|
78
|
-
//projetar a coluna
|
|
79
|
-
let initial = [];
|
|
80
|
-
let valores = this.dataSet.map(d => d[c.Campo]);
|
|
81
|
-
c.Valores = valores.filter((value, index, self) => {
|
|
82
|
-
return self.indexOf(value) === index;
|
|
83
|
-
}).map(v => { return { Selecionado: false, Valor: v } });
|
|
84
|
-
// console.log(c.Campo, valores);
|
|
85
|
-
// console.log(c.Valores)
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
ngOnInit() {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
//this.inicializaGrupo();
|
|
94
|
-
//this.agrupar('Marca');
|
|
95
|
-
//console.log('inputs', this.inputs);
|
|
96
|
-
//console.log('Input empresa', this.empresaId);
|
|
97
|
-
GridTabela.init(this.tabelaCampos);
|
|
98
|
-
this.valoresFiltro();
|
|
99
|
-
this.filteredDataSet = this.dataSet;
|
|
100
|
-
console.log('Init Tabela campos', this.tabelaCampos);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
ngOnChanges(changes: SimpleChanges) {
|
|
104
|
-
console.log('On changes Tabela campos', this.tabelaCampos);
|
|
105
|
-
//evento chamado quando o dataset for atualizado
|
|
106
|
-
//inicializar vars de paginação
|
|
107
|
-
this.initPage();
|
|
108
|
-
this.todosSelecionados = false;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
initPage() {
|
|
112
|
-
this.page = 1;
|
|
113
|
-
this.totalRec = this.filteredDataSet.length;
|
|
114
|
-
this.totalPages = Math.ceil(this.totalRec / this.pageOffset);
|
|
115
|
-
|
|
116
|
-
if (this.inMemoryPagination === true) {
|
|
117
|
-
this.getRegistrosPage();
|
|
118
|
-
} else {
|
|
119
|
-
this.pageDataSet = this.filteredDataSet;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
getRegistrosPage() {
|
|
124
|
-
this.start = (this.page - 1) * this.pageOffset;
|
|
125
|
-
console.log('dataset', this.filteredDataSet);
|
|
126
|
-
console.log('start', this.start);
|
|
127
|
-
console.log('offset', this.pageOffset);
|
|
128
|
-
this.pageDataSet = this.filteredDataSet.slice(this.start, (this.start + this.pageOffset));
|
|
129
|
-
console.log('page dataset', this.pageDataSet);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
proximo() {
|
|
133
|
-
if (this.page < this.totalPages) {
|
|
134
|
-
this.page++;
|
|
135
|
-
this.getRegistrosPage();
|
|
136
|
-
this.gerarArrayPags();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
anterior() {
|
|
141
|
-
if (this.page > 1) {
|
|
142
|
-
this.page--;
|
|
143
|
-
this.getRegistrosPage();
|
|
144
|
-
this.gerarArrayPags();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
gerarArrayPags() {
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
inicializaGrupo() {
|
|
153
|
-
//inicializar o primeiro grupo 'default'
|
|
154
|
-
this.camposDisplay = this.tabelaCampos.Colunas;
|
|
155
|
-
this.grupos[0].Tabela = this.camposDisplay;
|
|
156
|
-
this.grupos[0].Dados = this.dataSet;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
agrupar(campo: string) {
|
|
160
|
-
this.groups.push(campo);
|
|
161
|
-
let level = 0;
|
|
162
|
-
for (let g in this.groups) {
|
|
163
|
-
console.log(g);
|
|
164
|
-
//filtrar os dados
|
|
165
|
-
let result = this.dataSet.reduce((group, data) => {
|
|
166
|
-
const { g } = data;
|
|
167
|
-
group[g] = group[campo] ?? [];
|
|
168
|
-
group[g].push(data);
|
|
169
|
-
return group;
|
|
170
|
-
}, {});
|
|
171
|
-
console.log(result);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
filtrarCampos(coluna = '') {
|
|
177
|
-
if (coluna != '') {
|
|
178
|
-
|
|
179
|
-
} else {
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
filtrar(col: GridColuna) {
|
|
185
|
-
//console.log('filtrar', col);
|
|
186
|
-
if (col.Valores && col.Valores.find(v => v.Selecionado) != null) {
|
|
187
|
-
const valores = col.Valores.filter(v => v.Selecionado).map(v => v.Valor);
|
|
188
|
-
|
|
189
|
-
//filtrar por valores selecionados
|
|
190
|
-
this.filteredDataSet = this.dataSet.filter(d => valores.indexOf(d[col.Campo]) > -1);
|
|
191
|
-
} else if (col.FiltroOperador && col.FiltroValor) {
|
|
192
|
-
//console.log(col.FiltroOperador, col.FiltroValor)
|
|
193
|
-
try {
|
|
194
|
-
this.filteredDataSet = this.dataSet.filter(d => {
|
|
195
|
-
switch (col.FiltroOperador) {
|
|
196
|
-
case "=":
|
|
197
|
-
return d[col.Campo] == col.FiltroValor;
|
|
198
|
-
case ">=":
|
|
199
|
-
if (col.Tipo == 'number') {
|
|
200
|
-
return LibService.stringToDecimal(d[col.Campo], true) >= LibService.stringToDecimal(col.FiltroValor, true);
|
|
201
|
-
} else if (col.Tipo == 'data') {
|
|
202
|
-
return new Date(this.dataToString(d[col.Campo])) >= new Date(this.dataToString(col.FiltroValor));
|
|
203
|
-
} else
|
|
204
|
-
return d[col.Campo] >= col.FiltroValor;
|
|
205
|
-
case "<=":
|
|
206
|
-
if (col.Tipo == 'number') {
|
|
207
|
-
return LibService.stringToDecimal(d[col.Campo], true) <= LibService.stringToDecimal(col.FiltroValor, true);
|
|
208
|
-
} else
|
|
209
|
-
return d[col.Campo] <= col.FiltroValor;
|
|
210
|
-
case "tem":
|
|
211
|
-
return d[col.Campo].toString().toLowerCase().indexOf(col.FiltroValor.toLowerCase()) > -1;
|
|
212
|
-
default:
|
|
213
|
-
return true;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
});
|
|
217
|
-
} catch(ex) {
|
|
218
|
-
console.log(ex);
|
|
219
|
-
this.filteredDataSet = this.dataSet;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
col.FiltroVisivel = false;
|
|
223
|
-
|
|
224
|
-
this.initPage();
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
getPage() {
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
limpar() {
|
|
232
|
-
this.filteredDataSet = this.dataSet;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
dataToString(data: string): string {
|
|
236
|
-
if (data) {
|
|
237
|
-
return data.split('/').reverse().join('-');
|
|
238
|
-
} else {
|
|
239
|
-
return "";
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
ordenar(col: GridColuna) {
|
|
244
|
-
if (col.OrdemStatus == 0 || col.OrdemStatus == -1) {
|
|
245
|
-
if (col.Tipo == 'data') {
|
|
246
|
-
this.filteredDataSet.sort((a, b) => this.dataToString(a[col.Campo]) > this.dataToString(b[col.Campo]) ? 1 : (this.dataToString(a[col.Campo]) < this.dataToString(b[col.Campo]) ? -1 : 0));
|
|
247
|
-
} else if (col.Tipo == 'number') {
|
|
248
|
-
this.filteredDataSet.sort((a, b) => LibService.stringToDecimal(a[col.Campo]) > LibService.stringToDecimal(b[col.Campo]) ? 1 : (LibService.stringToDecimal(a[col.Campo]) < LibService.stringToDecimal(b[col.Campo]) ? -1 : 0));
|
|
249
|
-
} else
|
|
250
|
-
this.filteredDataSet.sort((a, b) => a[col.Campo] > b[col.Campo] ? 1 : (a[col.Campo] < b[col.Campo] ? -1 : 0));
|
|
251
|
-
col.OrdemStatus = 1; //asc
|
|
252
|
-
} else {
|
|
253
|
-
if (col.Tipo == 'data') {
|
|
254
|
-
this.filteredDataSet.sort((a, b) => this.dataToString(a[col.Campo]) < this.dataToString(b[col.Campo]) ? 1 : (this.dataToString(a[col.Campo]) > this.dataToString(b[col.Campo]) ? -1 : 0));
|
|
255
|
-
} else if (col.Tipo == 'number') {
|
|
256
|
-
this.filteredDataSet.sort((a, b) => LibService.stringToDecimal(a[col.Campo], true) < LibService.stringToDecimal(b[col.Campo], true) ? 1 : (LibService.stringToDecimal(a[col.Campo], true) > LibService.stringToDecimal(b[col.Campo], true) ? -1 : 0));
|
|
257
|
-
} else
|
|
258
|
-
this.filteredDataSet.sort((a, b) => a[col.Campo] < b[col.Campo] ? 1 : (a[col.Campo] > b[col.Campo] ? -1 : 0));
|
|
259
|
-
col.OrdemStatus = -1; //desc
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
setFiltroOpen(col: any) {
|
|
264
|
-
col.FiltroVisivel = !col.FiltroVisivel
|
|
265
|
-
if (col.FiltroVisivel) {
|
|
266
|
-
this.selectedColuna = col;
|
|
267
|
-
//console.log(this.selectedColuna);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
selecionarTodos() {
|
|
272
|
-
//this.todosSelecionados = !this.todosSelecionados;
|
|
273
|
-
this.filteredDataSet.forEach(item => {
|
|
274
|
-
item[this.tabelaCampos.CampoSelecionar] = this.todosSelecionados;
|
|
275
|
-
});
|
|
276
|
-
this.selecionarChecked.emit();
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
selecionarLinha(item: any) {
|
|
280
|
-
this.selecionarItem.emit(item);
|
|
281
|
-
this.selectedItem = item;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
excluirLinha(item: any) {
|
|
285
|
-
this.excluirItem.emit(item);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
//check
|
|
289
|
-
selecionadoChecked() {
|
|
290
|
-
this.selecionarChecked.emit();
|
|
291
|
-
}
|
|
292
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
maxlength="{{ max }}"
|
|
3
|
-
-->
|
|
4
|
-
<div>
|
|
5
|
-
<ion-item lines="none" style="--background-focused: transparent;" [class]="itemClass" #itemArea>
|
|
6
|
-
<ion-label position="{{ labelPosition }}">{{ label }}</ion-label>
|
|
7
|
-
<!-- formControlName="{{ formControlName }}" -->
|
|
8
|
-
<textarea #inputArea
|
|
9
|
-
[placeholder]="placeholder"
|
|
10
|
-
[maxLength]="max"
|
|
11
|
-
(ionBlur)="onBlur()"
|
|
12
|
-
[value]="data"
|
|
13
|
-
[rows]="linhas"
|
|
14
|
-
(input)="writeValue(inputArea.value)"
|
|
15
|
-
[disabled]="readonly"
|
|
16
|
-
(focus)="entered()"
|
|
17
|
-
></textarea>
|
|
18
|
-
</ion-item>
|
|
19
|
-
|
|
20
|
-
<div class="validation-errors" *ngIf="form">
|
|
21
|
-
|
|
22
|
-
<ng-container *ngFor="let validation of validation_messages">
|
|
23
|
-
<div class="error-message"
|
|
24
|
-
*ngIf="form.get(formControlName)?.hasError(validation.type) && (form.get(formControlName)?.dirty || form.get(formControlName)?.touched)">
|
|
25
|
-
• {{ validation.message }}
|
|
26
|
-
</div>
|
|
27
|
-
</ng-container>
|
|
28
|
-
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
ion-label {
|
|
2
|
-
margin-bottom: 4px !important;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
ion-textarea {
|
|
6
|
-
//padding: 4px;
|
|
7
|
-
padding: var(--input-padding, 8px) !important;
|
|
8
|
-
border: 1px solid darkgray;
|
|
9
|
-
border-radius: 4px;
|
|
10
|
-
width: 100%;
|
|
11
|
-
margin-top: 2px;
|
|
12
|
-
/*max-height: 29px;*/
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
textarea {
|
|
16
|
-
//padding: 4px;
|
|
17
|
-
padding: var(--input-padding, 8px) !important;
|
|
18
|
-
border: 1px solid darkgray;
|
|
19
|
-
border-radius: 4px;
|
|
20
|
-
width: 100%;
|
|
21
|
-
margin-top: 2px;
|
|
22
|
-
resize: none;
|
|
23
|
-
/*max-height: 29px;*/
|
|
24
|
-
background-color: white;
|
|
25
|
-
|
|
26
|
-
//scrollbar-width: thin; /* or auto for default width */
|
|
27
|
-
//scrollbar-color: #4CAF50 #f1f1f1; /* thumb and track colors */
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//ion-item::part(native) {
|
|
32
|
-
/* não funcionou */
|
|
33
|
-
|
|
34
|
-
textarea::-webkit-scrollbar {
|
|
35
|
-
//width: 0.5em !important;
|
|
36
|
-
width: 10px;
|
|
37
|
-
height: 10px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
textarea::-webkit-scrollbar-track {
|
|
41
|
-
//-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
|
42
|
-
background: #f1f1f1;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
textarea::-webkit-scrollbar-thumb {
|
|
46
|
-
//background-color: darkgrey;
|
|
47
|
-
//outline: 1px solid slategrey;
|
|
48
|
-
border-radius: 12px;
|
|
49
|
-
background: var(--scroll-color-thumb, #808080);
|
|
50
|
-
}
|
|
51
|
-
textarea::-webkit-scrollbar-thumb:hover {
|
|
52
|
-
background: var(--scroll-color-hover, #5c5c5c);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
textarea:focus {
|
|
56
|
-
outline: none !important;
|
|
57
|
-
//--focus-color: blue;
|
|
58
|
-
border: 1px solid lightblue !important;
|
|
59
|
-
ion-label{
|
|
60
|
-
color: var(--ion-color-label-focus, blue) !important;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//}
|
|
64
|
-
.item-has-focus {
|
|
65
|
-
ion-label {
|
|
66
|
-
color: var(--ion-color-label-focus, blue) !important;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { InputAreaComponent } from './input-area.component';
|
|
4
|
-
|
|
5
|
-
describe('InputAreaComponent', () => {
|
|
6
|
-
let component: InputAreaComponent;
|
|
7
|
-
let fixture: ComponentFixture<InputAreaComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ InputAreaComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(InputAreaComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Component, ElementRef, Input, OnInit, 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-area',
|
|
7
|
-
templateUrl: './input-area.component.html',
|
|
8
|
-
styleUrls: ['./input-area.component.scss', './../baseComponent.scss'],
|
|
9
|
-
providers: [{
|
|
10
|
-
provide: NG_VALUE_ACCESSOR,
|
|
11
|
-
useExisting: InputAreaComponent,
|
|
12
|
-
multi: true
|
|
13
|
-
}]
|
|
14
|
-
})
|
|
15
|
-
export class InputAreaComponent extends BaseInputComponent implements OnInit, ControlValueAccessor {
|
|
16
|
-
@Input() linhas: number = 5;
|
|
17
|
-
|
|
18
|
-
@ViewChild("itemArea", {read: ElementRef}) itemArea: any;
|
|
19
|
-
//control value acessor
|
|
20
|
-
public data: string | any;
|
|
21
|
-
private onChange: Function = (data: string) => {};
|
|
22
|
-
private onTouch: Function = () => {};
|
|
23
|
-
private disabled: boolean = false;
|
|
24
|
-
public console = console;
|
|
25
|
-
|
|
26
|
-
writeValue(value: string | any): void {
|
|
27
|
-
//console.log('write value', value);
|
|
28
|
-
this.onChange(value);
|
|
29
|
-
this.data = value;
|
|
30
|
-
}
|
|
31
|
-
registerOnChange(fn: any): void {
|
|
32
|
-
this.onChange = fn;
|
|
33
|
-
}
|
|
34
|
-
registerOnTouched(fn: any): void {
|
|
35
|
-
this.onTouch = fn;
|
|
36
|
-
}
|
|
37
|
-
setDisabledState?(isDisabled: boolean): void {
|
|
38
|
-
this.disabled = this.disabled;
|
|
39
|
-
}
|
|
40
|
-
constructor(private renderer: Renderer2) {
|
|
41
|
-
super();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
override ngOnInit() {}
|
|
45
|
-
|
|
46
|
-
onBlur() {
|
|
47
|
-
//remover classe do ion-item
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
//this.renderer.addClass(document.getElementById("item-select"), "item-has-focus");
|
|
50
|
-
this.renderer.removeClass(this.itemArea.nativeElement, "item-has-focus");
|
|
51
|
-
//console.log('select focused', document.getElementById("item-select"));
|
|
52
|
-
}, 200);
|
|
53
|
-
|
|
54
|
-
if (this.form) {
|
|
55
|
-
this.form.get(this.formControlName)?.markAsTouched();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
entered() {
|
|
60
|
-
//adicionar classe ao ion-item
|
|
61
|
-
// console.log('select focused');
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
//this.renderer.addClass(document.getElementById("item-select"), "item-has-focus");
|
|
64
|
-
this.renderer.addClass(this.itemArea.nativeElement, "item-has-focus");
|
|
65
|
-
//console.log('select focused', document.getElementById("item-select"));
|
|
66
|
-
}, 200);
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!-- style="box-shadow: #4c8dff 0px 3px 3px 0.05px" -->
|
|
2
|
-
<div style="text-align:center;">
|
|
3
|
-
<ion-button [fill]="btnFill" size="normal" [color]="btnColor"
|
|
4
|
-
(click)="showImageBrowser()" [expand]="btnExpand" [disabled]="readOnly">
|
|
5
|
-
<ion-icon *ngIf="showIcon" class="ion-padding-end" [slot]="iconSlot" [src]="iconSrc" [name]="icon"></ion-icon>
|
|
6
|
-
{{ caption }}
|
|
7
|
-
</ion-button>
|
|
8
|
-
<input type="file" id="upimgfile" name="uploadfile" #inputNome [accept]="arquivoTipos" (change)="loadImagem()"
|
|
9
|
-
style="display: none;" />
|
|
10
|
-
</div>
|
|
11
|
-
|
|
File without changes
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { InputArquivoComponent } from './input-arquivo.component';
|
|
4
|
-
|
|
5
|
-
describe('InputArquivoComponent', () => {
|
|
6
|
-
let component: InputArquivoComponent;
|
|
7
|
-
let fixture: ComponentFixture<InputArquivoComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ InputArquivoComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(InputArquivoComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|