appproject-components 1.0.43 → 1.0.44

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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, Component, EventEmitter, Input, Output, ElementRef, ViewChild, Inject, InjectionToken, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
3
  import * as i3 from '@angular/forms';
4
- import { NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
4
+ import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
5
  import * as i1 from '@angular/common';
6
6
  import { CommonModule } from '@angular/common';
7
7
  import * as i2 from '@ionic/angular';
@@ -11,6 +11,8 @@ import { HttpClientModule } from '@angular/common/http';
11
11
  import { Subject, of, Observable } from 'rxjs';
12
12
  import { debounceTime, switchMap } from 'rxjs/operators';
13
13
  import * as i1$1 from '@angular/platform-browser';
14
+ import * as i4 from 'appproject-lib';
15
+ import { GridTabela, LibService, ValorFormatPipe, SafeHtmlPipe } from 'appproject-lib';
14
16
 
15
17
  class AppprojectComponentsService {
16
18
  constructor() { }
@@ -2119,6 +2121,274 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImpor
2119
2121
  type: Input
2120
2122
  }] } });
2121
2123
 
2124
+ class GridViewComponent {
2125
+ constructor() {
2126
+ this.minHeight = '400px';
2127
+ this.inMemoryPagination = false;
2128
+ this.selecionarItem = new EventEmitter();
2129
+ this.excluirItem = new EventEmitter();
2130
+ this.selecionarChecked = new EventEmitter();
2131
+ //inputs = inject(new InjectionToken<any>('title inputs'));
2132
+ this.grupos = [{ Coluna: '', Tabela: null, Dados: null, Nivel: 0 }];
2133
+ // tabelaCampos = {
2134
+ // Selecionar: false,
2135
+ // Exportar: true,
2136
+ // Colunas: [
2137
+ // { Campo: 'Id', Titulo: 'Id', Tamanho: '10%', Ordem: true, Grupo: false, Filtrar: true, OrdemStatus: 0, Tipo: 'number', Valores: [], FiltroOperador: '=', FiltroValor: '', FiltroVisivel: false },
2138
+ // { Campo: 'Marca', Titulo: 'Marca', Tamanho: '25%', Ordem: true, Grupo: true, Filtrar: true, OrdemStatus: 0, Tipo: 'string', Valores: [], FiltroOperador: '=', FiltroValor: '', FiltroVisivel: false },
2139
+ // { Campo: 'Descricao', Titulo: 'Descrição', Tamanho: '25%', Ordem: true, Grupo: true, Filtrar: true, OrdemStatus: 0, Tipo: 'string', Valores: [], FiltroOperador: '=', FiltroValor: '', FiltroVisivel: false },
2140
+ // { Campo: 'Data', Titulo: 'Data', Tamanho: '20%', Ordem: true, Grupo: true, Filtrar: true, OrdemStatus: 0, Tipo: 'date', Valores: [], FiltroOperador: '=', FiltroValor: '', FiltroVisivel: false },
2141
+ // { Campo: 'Valor', Titulo: 'Valor', Tamanho: '20%', Ordem: true, Grupo: false, Filtrar: true, OrdemStatus: 0, Tipo: 'number', Valores: [], FiltroOperador: '=', FiltroValor: '', FiltroVisivel: false },
2142
+ // ]
2143
+ // }
2144
+ // dataSet: Array<any> = [
2145
+ // { Id: 1, Marca: 'Apple', Descricao: 'IPhone 14', Data: '2023-05-01', Valor: 7899.99 },
2146
+ // { Id: 2, Marca: 'Apple', Descricao: 'MacBook Pro', Data: '2023-06-01', Valor: 17999.99 },
2147
+ // { Id: 3, Marca: 'Samsung', Descricao: 'Galaxy S23', Data: '2023-05-01', Valor: 6899.99 },
2148
+ // { Id: 4, Marca: 'Sony', Descricao: 'PS 5', Data: '2023-06-01', Valor: 4899.99 },
2149
+ // { Id: 5, Marca: 'Samsung', Descricao: 'Watch 23', Data: '2023-05-01', Valor: 1899.99 },
2150
+ // ]
2151
+ this.groups = [];
2152
+ this.filteredDataSet = [];
2153
+ this.pageDataSet = [];
2154
+ //array com os campos filtrados para display
2155
+ this.camposDisplay = [];
2156
+ //filtro
2157
+ this.isFiltroOpen = false;
2158
+ this.todosSelecionados = false;
2159
+ //pagination
2160
+ //página atual
2161
+ this.page = 1;
2162
+ //registros por página
2163
+ this.pageOffset = 20;
2164
+ }
2165
+ valoresFiltro() {
2166
+ this.tabelaCampos.Colunas.forEach(c => {
2167
+ if (c.Filtrar) {
2168
+ //projetar a coluna
2169
+ let initial = [];
2170
+ let valores = this.dataSet.map(d => d[c.Campo]);
2171
+ c.Valores = valores.filter((value, index, self) => {
2172
+ return self.indexOf(value) === index;
2173
+ }).map(v => { return { Selecionado: false, Valor: v }; });
2174
+ // console.log(c.Campo, valores);
2175
+ // console.log(c.Valores)
2176
+ }
2177
+ });
2178
+ }
2179
+ ngOnInit() {
2180
+ //this.inicializaGrupo();
2181
+ //this.agrupar('Marca');
2182
+ //console.log('inputs', this.inputs);
2183
+ //console.log('Input empresa', this.empresaId);
2184
+ GridTabela.init(this.tabelaCampos);
2185
+ this.valoresFiltro();
2186
+ this.filteredDataSet = this.dataSet;
2187
+ console.log('Init Tabela campos', this.tabelaCampos);
2188
+ }
2189
+ ngOnChanges(changes) {
2190
+ console.log('On changes Tabela campos', this.tabelaCampos);
2191
+ //evento chamado quando o dataset for atualizado
2192
+ //inicializar vars de paginação
2193
+ this.initPage();
2194
+ this.todosSelecionados = false;
2195
+ }
2196
+ initPage() {
2197
+ this.page = 1;
2198
+ this.totalRec = this.filteredDataSet.length;
2199
+ this.totalPages = Math.ceil(this.totalRec / this.pageOffset);
2200
+ if (this.inMemoryPagination === true) {
2201
+ this.getRegistrosPage();
2202
+ }
2203
+ else {
2204
+ this.pageDataSet = this.filteredDataSet;
2205
+ }
2206
+ }
2207
+ getRegistrosPage() {
2208
+ this.start = (this.page - 1) * this.pageOffset;
2209
+ console.log('dataset', this.filteredDataSet);
2210
+ console.log('start', this.start);
2211
+ console.log('offset', this.pageOffset);
2212
+ this.pageDataSet = this.filteredDataSet.slice(this.start, (this.start + this.pageOffset));
2213
+ console.log('page dataset', this.pageDataSet);
2214
+ }
2215
+ proximo() {
2216
+ if (this.page < this.totalPages) {
2217
+ this.page++;
2218
+ this.getRegistrosPage();
2219
+ this.gerarArrayPags();
2220
+ }
2221
+ }
2222
+ anterior() {
2223
+ if (this.page > 1) {
2224
+ this.page--;
2225
+ this.getRegistrosPage();
2226
+ this.gerarArrayPags();
2227
+ }
2228
+ }
2229
+ gerarArrayPags() {
2230
+ }
2231
+ inicializaGrupo() {
2232
+ //inicializar o primeiro grupo 'default'
2233
+ this.camposDisplay = this.tabelaCampos.Colunas;
2234
+ this.grupos[0].Tabela = this.camposDisplay;
2235
+ this.grupos[0].Dados = this.dataSet;
2236
+ }
2237
+ agrupar(campo) {
2238
+ this.groups.push(campo);
2239
+ let level = 0;
2240
+ for (let g in this.groups) {
2241
+ console.log(g);
2242
+ //filtrar os dados
2243
+ let result = this.dataSet.reduce((group, data) => {
2244
+ const { g } = data;
2245
+ group[g] = group[campo] ?? [];
2246
+ group[g].push(data);
2247
+ return group;
2248
+ }, {});
2249
+ console.log(result);
2250
+ }
2251
+ }
2252
+ filtrarCampos(coluna = '') {
2253
+ if (coluna != '') {
2254
+ }
2255
+ else {
2256
+ }
2257
+ }
2258
+ filtrar(col) {
2259
+ //console.log('filtrar', col);
2260
+ if (col.Valores && col.Valores.find(v => v.Selecionado) != null) {
2261
+ const valores = col.Valores.filter(v => v.Selecionado).map(v => v.Valor);
2262
+ //filtrar por valores selecionados
2263
+ this.filteredDataSet = this.dataSet.filter(d => valores.indexOf(d[col.Campo]) > -1);
2264
+ }
2265
+ else if (col.FiltroOperador && col.FiltroValor) {
2266
+ //console.log(col.FiltroOperador, col.FiltroValor)
2267
+ try {
2268
+ this.filteredDataSet = this.dataSet.filter(d => {
2269
+ switch (col.FiltroOperador) {
2270
+ case "=":
2271
+ return d[col.Campo] == col.FiltroValor;
2272
+ case ">=":
2273
+ if (col.Tipo == 'number') {
2274
+ return LibService.stringToDecimal(d[col.Campo], true) >= LibService.stringToDecimal(col.FiltroValor, true);
2275
+ }
2276
+ else if (col.Tipo == 'data') {
2277
+ return new Date(this.dataToString(d[col.Campo])) >= new Date(this.dataToString(col.FiltroValor));
2278
+ }
2279
+ else
2280
+ return d[col.Campo] >= col.FiltroValor;
2281
+ case "<=":
2282
+ if (col.Tipo == 'number') {
2283
+ return LibService.stringToDecimal(d[col.Campo], true) <= LibService.stringToDecimal(col.FiltroValor, true);
2284
+ }
2285
+ else
2286
+ return d[col.Campo] <= col.FiltroValor;
2287
+ case "tem":
2288
+ return d[col.Campo].toString().toLowerCase().indexOf(col.FiltroValor.toLowerCase()) > -1;
2289
+ default:
2290
+ return true;
2291
+ }
2292
+ });
2293
+ }
2294
+ catch (ex) {
2295
+ console.log(ex);
2296
+ this.filteredDataSet = this.dataSet;
2297
+ }
2298
+ }
2299
+ col.FiltroVisivel = false;
2300
+ this.initPage();
2301
+ }
2302
+ getPage() {
2303
+ }
2304
+ limpar() {
2305
+ this.filteredDataSet = this.dataSet;
2306
+ }
2307
+ dataToString(data) {
2308
+ if (data) {
2309
+ return data.split('/').reverse().join('-');
2310
+ }
2311
+ else {
2312
+ return "";
2313
+ }
2314
+ }
2315
+ ordenar(col) {
2316
+ if (col.OrdemStatus == 0 || col.OrdemStatus == -1) {
2317
+ if (col.Tipo == 'data') {
2318
+ 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));
2319
+ }
2320
+ else if (col.Tipo == 'number') {
2321
+ 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));
2322
+ }
2323
+ else
2324
+ this.filteredDataSet.sort((a, b) => a[col.Campo] > b[col.Campo] ? 1 : (a[col.Campo] < b[col.Campo] ? -1 : 0));
2325
+ col.OrdemStatus = 1; //asc
2326
+ }
2327
+ else {
2328
+ if (col.Tipo == 'data') {
2329
+ 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));
2330
+ }
2331
+ else if (col.Tipo == 'number') {
2332
+ 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));
2333
+ }
2334
+ else
2335
+ this.filteredDataSet.sort((a, b) => a[col.Campo] < b[col.Campo] ? 1 : (a[col.Campo] > b[col.Campo] ? -1 : 0));
2336
+ col.OrdemStatus = -1; //desc
2337
+ }
2338
+ }
2339
+ setFiltroOpen(col) {
2340
+ col.FiltroVisivel = !col.FiltroVisivel;
2341
+ if (col.FiltroVisivel) {
2342
+ this.selectedColuna = col;
2343
+ //console.log(this.selectedColuna);
2344
+ }
2345
+ }
2346
+ selecionarTodos() {
2347
+ //this.todosSelecionados = !this.todosSelecionados;
2348
+ this.filteredDataSet.forEach(item => {
2349
+ item[this.tabelaCampos.CampoSelecionar] = this.todosSelecionados;
2350
+ });
2351
+ this.selecionarChecked.emit();
2352
+ }
2353
+ selecionarLinha(item) {
2354
+ this.selecionarItem.emit(item);
2355
+ this.selectedItem = item;
2356
+ }
2357
+ excluirLinha(item) {
2358
+ this.excluirItem.emit(item);
2359
+ }
2360
+ //check
2361
+ selecionadoChecked() {
2362
+ this.selecionarChecked.emit();
2363
+ }
2364
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: GridViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2365
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.7", type: GridViewComponent, selector: "kb-grid-view", inputs: { empresaId: "empresaId", tabelaCampos: "tabelaCampos", dataSet: "dataSet", minHeight: "minHeight", inMemoryPagination: "inMemoryPagination", filteredDataSet: "filteredDataSet", pageOffset: "pageOffset" }, outputs: { selecionarItem: "selecionarItem", excluirItem: "excluirItem", selecionarChecked: "selecionarChecked" }, usesOnChanges: true, ngImport: i0, template: "<div style=\"font-size: 14px;\">\n <div id=\"painelExportacao\">\n <ion-row *ngIf=\"inMemoryPagination\">\n <!--\n <ion-col size=\"2\">\n <ion-button *ngIf=\"tabelaCampos.Selecionar === true\" size=\"small\" fill=\"outline\" color=\"medium\"\n (click)=\"selecionarTodos()\">Selecionar Todos</ion-button>\n </ion-col>\n -->\n <ion-col size=\"3\">\n <ion-button *ngIf=\"inMemoryPagination === true\" size=\"small\" fill=\"outline\" color=\"bluetool\"\n (click)=\"anterior()\">\n <ion-icon name=\"chevron-back-outline\" slot=\"start\"></ion-icon>\n Anterior\n </ion-button>\n <ion-button *ngIf=\"inMemoryPagination === true\" size=\"small\" fill=\"outline\" color=\"bluetool\"\n (click)=\"proximo()\">\n Pr\u00F3ximo\n <ion-icon name=\"chevron-forward-outline\" slot=\"end\"></ion-icon>\n </ion-button> \n </ion-col>\n <ion-col size=\"2\">\n <span style=\"display: block; margin-top: 10px;\" *ngIf=\"inMemoryPagination && totalRec > 0\">Exibindo {{ start + 1 }} - {{ (start + pageOffset) < totalRec ? (start + pageOffset) : totalRec }} total de {{ totalRec }} \n </span> \n </ion-col>\n </ion-row>\n </div>\n <div style=\"width: 100%;\" [style.min-height]=\"minHeight\">\n <table class=\"grid\">\n <thead>\n <tr style=\"background-color: var(--ion-color-bluetool); color: white;\">\n <td *ngIf=\"tabelaCampos.Selecionar === true\" style=\"width: 3%; text-align: center;\">\n <input type=\"checkbox\" [(ngModel)]=\"todosSelecionados\" (change)=\"selecionarTodos()\">\n </td>\n <td *ngFor=\"let col of tabelaCampos.Colunas\" [style.width]=\"col.Tamanho\">\n <div style=\"position: relative;\">\n <div style=\"display: flex; justify-content: space-between; align-items: end;\">\n <strong>{{ col.Titulo }}</strong>\n <div>\n <ion-icon *ngIf=\"col.Ordem\" slot=\"end\" (click)=\"ordenar(col)\" style=\"cursor: pointer;\"\n [name]=\"col.OrdemStatus == 0 ? 'swap-vertical' : (col.OrdemStatus == 1 ? 'arrow-up': 'arrow-down')\"></ion-icon>\n \n <ion-icon *ngIf=\"col.Filtrar\" name=\"funnel\" (click)=\"setFiltroOpen(col)\" slot=\"end\"></ion-icon>\n </div>\n </div>\n \n \n <div class=\"caixaGrande\" [hidden]=\"!col.FiltroVisivel\" tabindex=\"-1\"\n style=\"color: black; display: block; position: absolute; z-index: 800; width: 210px; right: 0px; opacity: 0.9;\">\n Filtrar:\n <div>\n <div style=\"display: flex; justify-content: space-between; align-items: start;\">\n <select style=\"width: 80px;\" [(ngModel)]=\"col.FiltroOperador\">\n <option>=</option>\n <option>&gt;=</option>\n <option>&lt;=</option>\n <option>tem</option>\n </select>\n <input style=\"width: 100px;\" type=\"text\" [(ngModel)]=\"col.FiltroValor\">\n </div>\n <ion-button size=\"small\" color=\"medium\" expand=\"block\" (click)=\"filtrar(col)\">Filtrar</ion-button>\n <ion-button size=\"small\" color=\"light\" expand=\"block\" (click)=\"limpar()\">Limpar</ion-button>\n </div>\n <div *ngIf=\"col.Valores\" class=\"scroll-container\" style=\"height: 200px; overflow-y: scroll;\">\n <div *ngFor=\"let valor of col.Valores\">\n <input type=\"checkbox\" [(ngModel)]=\"valor.Selecionado\">\n <span>{{ valor.Valor }}</span>\n </div>\n </div>\n </div>\n \n </div>\n </td>\n <td *ngIf=\"tabelaCampos.Excluir === true\">\n \n </td>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let item of pageDataSet\" [class]=\"item == selectedItem ? 'item-selecionado' : '' \">\n <td *ngIf=\"tabelaCampos.Selecionar === true\" style=\"text-align: center; cursor: auto;\">\n <input type=\"checkbox\" [(ngModel)]=\"item[tabelaCampos.CampoSelecionar]\" (change)=\"selecionadoChecked()\">\n </td>\n <td class=\"col\" *ngFor=\"let col of tabelaCampos.Colunas\" [style.width]=\"col.Tamanho\"\n [style.text-align]=\"col.Tipo == 'number' ? 'right' : (col.Alinhamento ?? 'left')\"\n (click)=\"col.ClickFunction ? col.ClickFunction(item) : selecionarLinha(item)\">\n <span *ngIf=\"col.Pipe == 'date'\">{{ item[col.Campo] | date: 'dd/MM/yyyy' }}</span> \n <span *ngIf=\"col.Pipe == 'valor'\">{{ item[col.Campo] | valorFormat }}</span>\n <span *ngIf=\"col.RenderFunction\" [innerHtml]=\"col.RenderFunction(item) | safeHtml\"></span>\n <span *ngIf=\"!col.Pipe && !col.RenderFunction\">{{ item[col.Campo] ?? col.Default }}</span>\n </td>\n <td *ngIf=\"tabelaCampos.Excluir === true\" style=\"padding: 0px; text-align: center;\">\n <ion-button size=\"small\" color=\"danger\" fill=\"outline\" style=\"transform: scale(0.85);\" (click)=\"excluirLinha(item)\">\n <ion-icon name=\"trash\"></ion-icon>\n </ion-button>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n \n <ion-modal [isOpen]=\"isFiltroOpen\" (didDismiss)=\"isFiltroOpen = false;\">\n <ng-template>\n <ion-content class=\"ion-padding\">\n <div class=\"caixaGrande\">\n Filtrar:\n <div *ngIf=\"selectedColuna.Valores\">\n <div *ngFor=\"let valor of selectedColuna.Valores\">\n <span>{{ valor }}</span>\n </div>\n </div>\n </div>\n </ion-content>\n </ng-template>\n </ion-modal>\n </div>", styles: [".grid{width:100%}.grid thead td{border:1px solid gray;padding:4px}.grid tbody td{border:1px solid gray;padding:2px 4px}.grid tbody tr{cursor:pointer}.grid tbody tr:hover{background-color:#699ccc80;transition-duration:.5s}.grid tbody tr.item-selecionado{background-color:#699ccc33}\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.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonContent, selector: "ion-content", inputs: ["color", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "component", type: i2.IonModal, selector: "ion-modal", inputs: ["animated", "keepContentsMounted", "backdropBreakpoint", "backdropDismiss", "breakpoints", "canDismiss", "cssClass", "enterAnimation", "event", "handle", "handleBehavior", "initialBreakpoint", "isOpen", "keyboardClose", "leaveAnimation", "mode", "presentingElement", "showBackdrop", "translucent", "trigger"] }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i3.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { kind: "pipe", type: i4.ValorFormatPipe, name: "valorFormat" }, { kind: "pipe", type: i4.SafeHtmlPipe, name: "safeHtml" }] }); }
2366
+ }
2367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: GridViewComponent, decorators: [{
2368
+ type: Component,
2369
+ args: [{ selector: 'kb-grid-view', template: "<div style=\"font-size: 14px;\">\n <div id=\"painelExportacao\">\n <ion-row *ngIf=\"inMemoryPagination\">\n <!--\n <ion-col size=\"2\">\n <ion-button *ngIf=\"tabelaCampos.Selecionar === true\" size=\"small\" fill=\"outline\" color=\"medium\"\n (click)=\"selecionarTodos()\">Selecionar Todos</ion-button>\n </ion-col>\n -->\n <ion-col size=\"3\">\n <ion-button *ngIf=\"inMemoryPagination === true\" size=\"small\" fill=\"outline\" color=\"bluetool\"\n (click)=\"anterior()\">\n <ion-icon name=\"chevron-back-outline\" slot=\"start\"></ion-icon>\n Anterior\n </ion-button>\n <ion-button *ngIf=\"inMemoryPagination === true\" size=\"small\" fill=\"outline\" color=\"bluetool\"\n (click)=\"proximo()\">\n Pr\u00F3ximo\n <ion-icon name=\"chevron-forward-outline\" slot=\"end\"></ion-icon>\n </ion-button> \n </ion-col>\n <ion-col size=\"2\">\n <span style=\"display: block; margin-top: 10px;\" *ngIf=\"inMemoryPagination && totalRec > 0\">Exibindo {{ start + 1 }} - {{ (start + pageOffset) < totalRec ? (start + pageOffset) : totalRec }} total de {{ totalRec }} \n </span> \n </ion-col>\n </ion-row>\n </div>\n <div style=\"width: 100%;\" [style.min-height]=\"minHeight\">\n <table class=\"grid\">\n <thead>\n <tr style=\"background-color: var(--ion-color-bluetool); color: white;\">\n <td *ngIf=\"tabelaCampos.Selecionar === true\" style=\"width: 3%; text-align: center;\">\n <input type=\"checkbox\" [(ngModel)]=\"todosSelecionados\" (change)=\"selecionarTodos()\">\n </td>\n <td *ngFor=\"let col of tabelaCampos.Colunas\" [style.width]=\"col.Tamanho\">\n <div style=\"position: relative;\">\n <div style=\"display: flex; justify-content: space-between; align-items: end;\">\n <strong>{{ col.Titulo }}</strong>\n <div>\n <ion-icon *ngIf=\"col.Ordem\" slot=\"end\" (click)=\"ordenar(col)\" style=\"cursor: pointer;\"\n [name]=\"col.OrdemStatus == 0 ? 'swap-vertical' : (col.OrdemStatus == 1 ? 'arrow-up': 'arrow-down')\"></ion-icon>\n \n <ion-icon *ngIf=\"col.Filtrar\" name=\"funnel\" (click)=\"setFiltroOpen(col)\" slot=\"end\"></ion-icon>\n </div>\n </div>\n \n \n <div class=\"caixaGrande\" [hidden]=\"!col.FiltroVisivel\" tabindex=\"-1\"\n style=\"color: black; display: block; position: absolute; z-index: 800; width: 210px; right: 0px; opacity: 0.9;\">\n Filtrar:\n <div>\n <div style=\"display: flex; justify-content: space-between; align-items: start;\">\n <select style=\"width: 80px;\" [(ngModel)]=\"col.FiltroOperador\">\n <option>=</option>\n <option>&gt;=</option>\n <option>&lt;=</option>\n <option>tem</option>\n </select>\n <input style=\"width: 100px;\" type=\"text\" [(ngModel)]=\"col.FiltroValor\">\n </div>\n <ion-button size=\"small\" color=\"medium\" expand=\"block\" (click)=\"filtrar(col)\">Filtrar</ion-button>\n <ion-button size=\"small\" color=\"light\" expand=\"block\" (click)=\"limpar()\">Limpar</ion-button>\n </div>\n <div *ngIf=\"col.Valores\" class=\"scroll-container\" style=\"height: 200px; overflow-y: scroll;\">\n <div *ngFor=\"let valor of col.Valores\">\n <input type=\"checkbox\" [(ngModel)]=\"valor.Selecionado\">\n <span>{{ valor.Valor }}</span>\n </div>\n </div>\n </div>\n \n </div>\n </td>\n <td *ngIf=\"tabelaCampos.Excluir === true\">\n \n </td>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let item of pageDataSet\" [class]=\"item == selectedItem ? 'item-selecionado' : '' \">\n <td *ngIf=\"tabelaCampos.Selecionar === true\" style=\"text-align: center; cursor: auto;\">\n <input type=\"checkbox\" [(ngModel)]=\"item[tabelaCampos.CampoSelecionar]\" (change)=\"selecionadoChecked()\">\n </td>\n <td class=\"col\" *ngFor=\"let col of tabelaCampos.Colunas\" [style.width]=\"col.Tamanho\"\n [style.text-align]=\"col.Tipo == 'number' ? 'right' : (col.Alinhamento ?? 'left')\"\n (click)=\"col.ClickFunction ? col.ClickFunction(item) : selecionarLinha(item)\">\n <span *ngIf=\"col.Pipe == 'date'\">{{ item[col.Campo] | date: 'dd/MM/yyyy' }}</span> \n <span *ngIf=\"col.Pipe == 'valor'\">{{ item[col.Campo] | valorFormat }}</span>\n <span *ngIf=\"col.RenderFunction\" [innerHtml]=\"col.RenderFunction(item) | safeHtml\"></span>\n <span *ngIf=\"!col.Pipe && !col.RenderFunction\">{{ item[col.Campo] ?? col.Default }}</span>\n </td>\n <td *ngIf=\"tabelaCampos.Excluir === true\" style=\"padding: 0px; text-align: center;\">\n <ion-button size=\"small\" color=\"danger\" fill=\"outline\" style=\"transform: scale(0.85);\" (click)=\"excluirLinha(item)\">\n <ion-icon name=\"trash\"></ion-icon>\n </ion-button>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n \n <ion-modal [isOpen]=\"isFiltroOpen\" (didDismiss)=\"isFiltroOpen = false;\">\n <ng-template>\n <ion-content class=\"ion-padding\">\n <div class=\"caixaGrande\">\n Filtrar:\n <div *ngIf=\"selectedColuna.Valores\">\n <div *ngFor=\"let valor of selectedColuna.Valores\">\n <span>{{ valor }}</span>\n </div>\n </div>\n </div>\n </ion-content>\n </ng-template>\n </ion-modal>\n </div>", styles: [".grid{width:100%}.grid thead td{border:1px solid gray;padding:4px}.grid tbody td{border:1px solid gray;padding:2px 4px}.grid tbody tr{cursor:pointer}.grid tbody tr:hover{background-color:#699ccc80;transition-duration:.5s}.grid tbody tr.item-selecionado{background-color:#699ccc33}\n"] }]
2370
+ }], ctorParameters: () => [], propDecorators: { empresaId: [{
2371
+ type: Input
2372
+ }], tabelaCampos: [{
2373
+ type: Input
2374
+ }], dataSet: [{
2375
+ type: Input
2376
+ }], minHeight: [{
2377
+ type: Input
2378
+ }], inMemoryPagination: [{
2379
+ type: Input
2380
+ }], selecionarItem: [{
2381
+ type: Output
2382
+ }], excluirItem: [{
2383
+ type: Output
2384
+ }], selecionarChecked: [{
2385
+ type: Output
2386
+ }], filteredDataSet: [{
2387
+ type: Input
2388
+ }], pageOffset: [{
2389
+ type: Input
2390
+ }] } });
2391
+
2122
2392
  const LibConfigService = new InjectionToken('LibConfig');
2123
2393
  class AppprojectComponentsModule {
2124
2394
  static forRoot(config) {
@@ -2153,10 +2423,14 @@ class AppprojectComponentsModule {
2153
2423
  InputCheckboxComponent,
2154
2424
  InputRadioComponent,
2155
2425
  TreeViewComponent,
2156
- TreeViewNivelComponent], imports: [CommonModule,
2426
+ TreeViewNivelComponent,
2427
+ GridViewComponent], imports: [CommonModule,
2157
2428
  HttpClientModule,
2158
2429
  IonicModule,
2159
- ReactiveFormsModule], exports: [AppprojectComponentsComponent,
2430
+ FormsModule,
2431
+ ReactiveFormsModule,
2432
+ ValorFormatPipe,
2433
+ SafeHtmlPipe], exports: [AppprojectComponentsComponent,
2160
2434
  InputTextComponent,
2161
2435
  InputFormatComponent,
2162
2436
  InputSelectComponent,
@@ -2175,10 +2449,12 @@ class AppprojectComponentsModule {
2175
2449
  InputCheckboxComponent,
2176
2450
  InputRadioComponent,
2177
2451
  TreeViewComponent,
2178
- TreeViewNivelComponent] }); }
2452
+ TreeViewNivelComponent,
2453
+ GridViewComponent] }); }
2179
2454
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsModule, imports: [CommonModule,
2180
2455
  HttpClientModule,
2181
2456
  IonicModule,
2457
+ FormsModule,
2182
2458
  ReactiveFormsModule] }); }
2183
2459
  }
2184
2460
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: AppprojectComponentsModule, decorators: [{
@@ -2204,13 +2480,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImpor
2204
2480
  InputCheckboxComponent,
2205
2481
  InputRadioComponent,
2206
2482
  TreeViewComponent,
2207
- TreeViewNivelComponent
2483
+ TreeViewNivelComponent,
2484
+ GridViewComponent
2208
2485
  ],
2209
2486
  imports: [
2210
2487
  CommonModule,
2211
2488
  HttpClientModule,
2212
2489
  IonicModule,
2213
- ReactiveFormsModule
2490
+ FormsModule,
2491
+ ReactiveFormsModule,
2492
+ ValorFormatPipe,
2493
+ SafeHtmlPipe
2214
2494
  ],
2215
2495
  exports: [
2216
2496
  AppprojectComponentsComponent,
@@ -2232,7 +2512,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImpor
2232
2512
  InputCheckboxComponent,
2233
2513
  InputRadioComponent,
2234
2514
  TreeViewComponent,
2235
- TreeViewNivelComponent
2515
+ TreeViewNivelComponent,
2516
+ GridViewComponent
2236
2517
  ],
2237
2518
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
2238
2519
  }]
@@ -2246,5 +2527,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImpor
2246
2527
  * Generated bundle index. Do not edit.
2247
2528
  */
2248
2529
 
2249
- export { AppprojectComponentsComponent, AppprojectComponentsModule, AppprojectComponentsService, BaseInputComponent, BtnActionComponent, BtnCancelarComponent, BtnExcluirComponent, BtnNovoComponent, BtnSalvarComponent, EntityEditComponent, InputAreaComponent, InputArquivoComponent, InputCepComponent, InputCheckboxComponent, InputFormatComponent, InputPesquisaComponent, InputRadioComponent, InputSelectComponent, InputTextComponent, InputValorComponent, LibConfigService, ModelTreeviewComponent, TreeViewComponent, TreeViewNivelComponent };
2530
+ export { AppprojectComponentsComponent, AppprojectComponentsModule, AppprojectComponentsService, BaseInputComponent, BtnActionComponent, BtnCancelarComponent, BtnExcluirComponent, BtnNovoComponent, BtnSalvarComponent, EntityEditComponent, GridViewComponent, InputAreaComponent, InputArquivoComponent, InputCepComponent, InputCheckboxComponent, InputFormatComponent, InputPesquisaComponent, InputRadioComponent, InputSelectComponent, InputTextComponent, InputValorComponent, LibConfigService, ModelTreeviewComponent, TreeViewComponent, TreeViewNivelComponent };
2250
2531
  //# sourceMappingURL=appproject-components.mjs.map