appproject-components 1.0.49 → 1.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/esm2022/appproject-components.mjs +5 -0
  2. package/esm2022/lib/appproject-components.component.mjs +22 -0
  3. package/esm2022/lib/appproject-components.module.mjs +159 -0
  4. package/esm2022/lib/appproject-components.service.mjs +14 -0
  5. package/esm2022/lib/baseInputComponent.mjs +69 -0
  6. package/esm2022/lib/buttons/baseBtnComponent.mjs +63 -0
  7. package/esm2022/lib/buttons/btn-action/btn-action.component.mjs +55 -0
  8. package/esm2022/lib/buttons/btn-cancelar/btn-cancelar.component.mjs +25 -0
  9. package/esm2022/lib/buttons/btn-excluir/btn-excluir.component.mjs +29 -0
  10. package/esm2022/lib/buttons/btn-novo/btn-novo.component.mjs +33 -0
  11. package/esm2022/lib/buttons/btn-salvar/btn-salvar.component.mjs +19 -0
  12. package/esm2022/lib/entity-edit/entity-edit.component.mjs +53 -0
  13. package/esm2022/lib/grid-view/grid-view.component.mjs +275 -0
  14. package/esm2022/lib/input-area/input-area.component.mjs +72 -0
  15. package/esm2022/lib/input-arquivo/input-arquivo.component.mjs +154 -0
  16. package/esm2022/lib/input-cep/input-cep.component.mjs +180 -0
  17. package/esm2022/lib/input-checkbox/input-checkbox.component.mjs +51 -0
  18. package/esm2022/lib/input-format/input-format.component.mjs +138 -0
  19. package/esm2022/lib/input-pesquisa/input-pesquisa.component.mjs +557 -0
  20. package/esm2022/lib/input-radio/input-radio.component.mjs +58 -0
  21. package/esm2022/lib/input-select/input-select.component.mjs +110 -0
  22. package/esm2022/lib/input-text/input-text.component.mjs +88 -0
  23. package/esm2022/lib/input-valor/input-valor.component.mjs +161 -0
  24. package/esm2022/lib/lib-config.mjs +2 -0
  25. package/esm2022/lib/model-treeview/model-treeview.component.mjs +126 -0
  26. package/esm2022/lib/tree-view/tree-view.component.mjs +104 -0
  27. package/esm2022/lib/tree-view-nivel/tree-view-nivel.component.mjs +50 -0
  28. package/esm2022/public-api.mjs +30 -0
  29. package/fesm2022/appproject-components.mjs +2531 -0
  30. package/fesm2022/appproject-components.mjs.map +1 -0
  31. package/index.d.ts +5 -0
  32. package/lib/appproject-components.component.d.ts +8 -0
  33. package/lib/appproject-components.module.d.ts +36 -0
  34. package/lib/appproject-components.service.d.ts +6 -0
  35. package/lib/baseInputComponent.d.ts +28 -0
  36. package/lib/buttons/baseBtnComponent.d.ts +19 -0
  37. package/lib/buttons/btn-action/btn-action.component.d.ts +21 -0
  38. package/lib/buttons/btn-cancelar/btn-cancelar.component.d.ts +10 -0
  39. package/lib/buttons/btn-excluir/btn-excluir.component.d.ts +12 -0
  40. package/lib/buttons/btn-novo/btn-novo.component.d.ts +13 -0
  41. package/lib/buttons/btn-salvar/btn-salvar.component.d.ts +9 -0
  42. package/lib/entity-edit/entity-edit.component.d.ts +22 -0
  43. package/lib/grid-view/grid-view.component.d.ts +52 -0
  44. package/lib/input-area/input-area.component.d.ts +24 -0
  45. package/lib/input-arquivo/input-arquivo.component.d.ts +43 -0
  46. package/lib/input-cep/input-cep.component.d.ts +29 -0
  47. package/lib/input-checkbox/input-checkbox.component.d.ts +21 -0
  48. package/lib/input-format/input-format.component.d.ts +27 -0
  49. package/lib/input-pesquisa/input-pesquisa.component.d.ts +69 -0
  50. package/lib/input-radio/input-radio.component.d.ts +23 -0
  51. package/lib/input-select/input-select.component.d.ts +32 -0
  52. package/lib/input-text/input-text.component.d.ts +33 -0
  53. package/lib/input-valor/input-valor.component.d.ts +29 -0
  54. package/{src/lib/lib-config.ts → lib/lib-config.d.ts} +3 -4
  55. package/lib/model-treeview/model-treeview.component.d.ts +39 -0
  56. package/lib/tree-view/tree-view.component.d.ts +23 -0
  57. package/lib/tree-view-nivel/tree-view-nivel.component.d.ts +17 -0
  58. package/package.json +26 -15
  59. package/{src/public-api.ts → public-api.d.ts} +24 -30
  60. package/karma.conf.js +0 -44
  61. package/ng-package.json +0 -7
  62. package/src/lib/appproject-components.component.spec.ts +0 -23
  63. package/src/lib/appproject-components.component.ts +0 -20
  64. package/src/lib/appproject-components.module.ts +0 -106
  65. package/src/lib/appproject-components.service.spec.ts +0 -16
  66. package/src/lib/appproject-components.service.ts +0 -9
  67. package/src/lib/baseComponent.scss +0 -162
  68. package/src/lib/baseInputComponent.ts +0 -35
  69. package/src/lib/buttons/baseBtnComponent.ts +0 -38
  70. package/src/lib/buttons/btn-action/btn-action.component.html +0 -11
  71. package/src/lib/buttons/btn-action/btn-action.component.scss +0 -7
  72. package/src/lib/buttons/btn-action/btn-action.component.spec.ts +0 -24
  73. package/src/lib/buttons/btn-action/btn-action.component.ts +0 -31
  74. package/src/lib/buttons/btn-cancelar/btn-cancelar.component.html +0 -14
  75. package/src/lib/buttons/btn-cancelar/btn-cancelar.component.scss +0 -5
  76. package/src/lib/buttons/btn-cancelar/btn-cancelar.component.spec.ts +0 -24
  77. package/src/lib/buttons/btn-cancelar/btn-cancelar.component.ts +0 -19
  78. package/src/lib/buttons/btn-excluir/btn-excluir.component.html +0 -6
  79. package/src/lib/buttons/btn-excluir/btn-excluir.component.scss +0 -5
  80. package/src/lib/buttons/btn-excluir/btn-excluir.component.spec.ts +0 -24
  81. package/src/lib/buttons/btn-excluir/btn-excluir.component.ts +0 -18
  82. package/src/lib/buttons/btn-novo/btn-novo.component.html +0 -14
  83. package/src/lib/buttons/btn-novo/btn-novo.component.scss +0 -8
  84. package/src/lib/buttons/btn-novo/btn-novo.component.spec.ts +0 -24
  85. package/src/lib/buttons/btn-novo/btn-novo.component.ts +0 -20
  86. package/src/lib/buttons/btn-salvar/btn-salvar.component.html +0 -8
  87. package/src/lib/buttons/btn-salvar/btn-salvar.component.scss +0 -5
  88. package/src/lib/buttons/btn-salvar/btn-salvar.component.spec.ts +0 -24
  89. package/src/lib/buttons/btn-salvar/btn-salvar.component.ts +0 -16
  90. package/src/lib/entity-edit/entity-edit.component.html +0 -143
  91. package/src/lib/entity-edit/entity-edit.component.scss +0 -4
  92. package/src/lib/entity-edit/entity-edit.component.spec.ts +0 -23
  93. package/src/lib/entity-edit/entity-edit.component.ts +0 -43
  94. package/src/lib/grid-view/grid-view.component.html +0 -116
  95. package/src/lib/grid-view/grid-view.component.scss +0 -47
  96. package/src/lib/grid-view/grid-view.component.spec.ts +0 -23
  97. package/src/lib/grid-view/grid-view.component.ts +0 -292
  98. package/src/lib/input-area/input-area.component.html +0 -30
  99. package/src/lib/input-area/input-area.component.scss +0 -68
  100. package/src/lib/input-area/input-area.component.spec.ts +0 -23
  101. package/src/lib/input-area/input-area.component.ts +0 -69
  102. package/src/lib/input-arquivo/input-arquivo.component.html +0 -11
  103. package/src/lib/input-arquivo/input-arquivo.component.scss +0 -0
  104. package/src/lib/input-arquivo/input-arquivo.component.spec.ts +0 -23
  105. package/src/lib/input-arquivo/input-arquivo.component.ts +0 -140
  106. package/src/lib/input-cep/input-cep.component.html +0 -38
  107. package/src/lib/input-cep/input-cep.component.scss +0 -0
  108. package/src/lib/input-cep/input-cep.component.spec.ts +0 -23
  109. package/src/lib/input-cep/input-cep.component.ts +0 -186
  110. package/src/lib/input-checkbox/input-checkbox.component.html +0 -12
  111. package/src/lib/input-checkbox/input-checkbox.component.scss +0 -11
  112. package/src/lib/input-checkbox/input-checkbox.component.spec.ts +0 -23
  113. package/src/lib/input-checkbox/input-checkbox.component.ts +0 -48
  114. package/src/lib/input-format/input-format.component.html +0 -32
  115. package/src/lib/input-format/input-format.component.scss +0 -47
  116. package/src/lib/input-format/input-format.component.spec.ts +0 -23
  117. package/src/lib/input-format/input-format.component.ts +0 -139
  118. package/src/lib/input-pesquisa/input-pesquisa.component.html +0 -77
  119. package/src/lib/input-pesquisa/input-pesquisa.component.scss +0 -127
  120. package/src/lib/input-pesquisa/input-pesquisa.component.spec.ts +0 -23
  121. package/src/lib/input-pesquisa/input-pesquisa.component.ts +0 -558
  122. package/src/lib/input-radio/input-radio.component.html +0 -21
  123. package/src/lib/input-radio/input-radio.component.scss +0 -3
  124. package/src/lib/input-radio/input-radio.component.spec.ts +0 -23
  125. package/src/lib/input-radio/input-radio.component.ts +0 -49
  126. package/src/lib/input-select/input-select.component.html +0 -29
  127. package/src/lib/input-select/input-select.component.scss +0 -62
  128. package/src/lib/input-select/input-select.component.spec.ts +0 -23
  129. package/src/lib/input-select/input-select.component.ts +0 -96
  130. package/src/lib/input-text/input-text.component.html +0 -48
  131. package/src/lib/input-text/input-text.component.scss +0 -63
  132. package/src/lib/input-text/input-text.component.spec.ts +0 -23
  133. package/src/lib/input-text/input-text.component.ts +0 -78
  134. package/src/lib/input-valor/input-valor.component.html +0 -32
  135. package/src/lib/input-valor/input-valor.component.scss +0 -47
  136. package/src/lib/input-valor/input-valor.component.spec.ts +0 -23
  137. package/src/lib/input-valor/input-valor.component.ts +0 -164
  138. package/src/lib/model-treeview/model-treeview.component.html +0 -20
  139. package/src/lib/model-treeview/model-treeview.component.scss +0 -0
  140. package/src/lib/model-treeview/model-treeview.component.spec.ts +0 -23
  141. package/src/lib/model-treeview/model-treeview.component.ts +0 -152
  142. package/src/lib/tree-view/tree-view.component.html +0 -96
  143. package/src/lib/tree-view/tree-view.component.scss +0 -50
  144. package/src/lib/tree-view/tree-view.component.spec.ts +0 -23
  145. package/src/lib/tree-view/tree-view.component.ts +0 -92
  146. package/src/lib/tree-view-nivel/tree-view-nivel.component.html +0 -17
  147. package/src/lib/tree-view-nivel/tree-view-nivel.component.scss +0 -8
  148. package/src/lib/tree-view-nivel/tree-view-nivel.component.spec.ts +0 -23
  149. package/src/lib/tree-view-nivel/tree-view-nivel.component.ts +0 -43
  150. package/src/test.ts +0 -15
  151. package/tsconfig.lib.json +0 -15
  152. package/tsconfig.lib.prod.json +0 -10
  153. package/tsconfig.spec.json +0 -17
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ModelTreeviewComponent } from './model-treeview.component';
4
-
5
- describe('ModelTreeviewComponent', () => {
6
- let component: ModelTreeviewComponent;
7
- let fixture: ComponentFixture<ModelTreeviewComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ ModelTreeviewComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(ModelTreeviewComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,152 +0,0 @@
1
- import { Component, Inject, Input, OnInit, Predicate, ViewChild } from '@angular/core';
2
- import { Subscription } from 'rxjs';
3
- import { TreeViewComponent } from '../tree-view/tree-view.component';
4
- import { LoadingController, ModalController } from '@ionic/angular';
5
- import { LibConfig } from '../lib-config';
6
- import { HttpClient } from '@angular/common/http';
7
- @Component({
8
- selector: 'kb-model-treeview',
9
- templateUrl: './model-treeview.component.html',
10
- styleUrls: ['./model-treeview.component.scss']
11
- })
12
- export class ModelTreeviewComponent implements OnInit {
13
- titulo: string = "Selecionar";
14
- campoId: string;
15
- campoPai: string;
16
- campoLabel: string;
17
- @Input() textoPesquisa: string = "";
18
- empresaSelecionadaId: number;
19
- empresaContabilidadeId: number;
20
- listaArvore: any[];
21
- tipo: string;
22
- //url da API para pesquisar os itens
23
- url: string;
24
- subscriptionClick: Subscription;
25
- subscribeId: string;
26
- //função para filtrar registros que podem ser clicados
27
- filterFunction: Predicate<any>;
28
- //especificos
29
- planoContas: number;
30
- maximizar: boolean = false;
31
- @ViewChild("treeViewComp") treeView: TreeViewComponent;
32
-
33
- BASE_API = this.config.apiUrl;
34
- constructor(@Inject('LibConfigService') private config: LibConfig,
35
- public modalCtrl: ModalController,
36
- private httpClient: HttpClient,
37
- private loadingCtrl: LoadingController) { }
38
-
39
- ngOnInit(): void {
40
- }
41
-
42
- ionViewDidEnter() {
43
- this.atualizaArvoreEntidade(this.tipo);
44
- }
45
-
46
- async atualizaArvoreEntidade(tipo: string) {
47
- let subscriptionC: Subscription;
48
- this.treeView.cadastro = this.subscribeId;
49
- let loading = await this.showLoading("Pesquisando...", true);
50
- loading.onDidDismiss().then(() => {
51
- subscriptionC?.unsubscribe();
52
- });
53
-
54
- this.url = this.url.startsWith('http') ? this.url : `${this.BASE_API}/${this.url}`;
55
-
56
- var url = this.url.replace('<<EMPRESA>>', this.empresaSelecionadaId.toString());
57
- var url = this.url.replace('<<FILTRO>>', '');
58
- // if (this.textoPesquisa) {
59
- // url += `?filtro=${this.textoPesquisa}`;
60
- // }
61
-
62
- subscriptionC = this.httpClient.get(url).subscribe({
63
- next: (result: any[]) => {
64
-
65
-
66
- /*
67
- empresaContato.forEach((ec) => {
68
- ec.LabelTree = ec.Nome;
69
- ec.EmpresaContatoPaiId = null; //campo ficticio para montar arvore
70
- ec.ClicableTree = true;
71
- });
72
-
73
- this.treeView.campoId = "EmpresaContatoId";
74
- this.treeView.campoPai = "EmpresaContatoPaiId";
75
- this.treeView.campoLabel = "LabelTree";
76
- this.treeView.itens = empresaContato;
77
- this.treeView.arvoreClick(false);
78
- */
79
-
80
-
81
- if (!this.campoPai) {
82
- this.campoPai = `${this.campoId}Pai`;
83
- }
84
-
85
-
86
- result.forEach((cc) => {
87
- cc.LabelTree = cc[this.campoLabel];
88
- if (!cc[this.campoPai]) {
89
- cc[this.campoPai] = null;
90
- }
91
-
92
- if (this.filterFunction != null) {
93
- const clicable = [{ ...cc }].find(this.filterFunction);
94
- if (clicable != null && cc.ClicableTree == null) {
95
- cc.ClicableTree = true;
96
- } else {
97
- cc.ClicableTree = false;
98
- }
99
- } else {
100
- cc.ClicableTree = true;
101
- }
102
- });
103
-
104
- console.log('tree result', result);
105
-
106
- this.treeView.campoId = this.campoId;
107
- this.treeView.campoPai = this.campoPai;
108
- this.treeView.campoLabel = this.campoLabel;
109
- this.treeView.itens = result;
110
- this.treeView.arvoreClick(false);
111
-
112
- loading.dismiss();
113
- },
114
- error: (error) => {
115
- loading.dismiss();
116
- console.log("Erro ao carregar os registros.<br>Tente mais tarde.");
117
- }
118
- });
119
-
120
- }
121
-
122
- clickRegistro(evento) {
123
- if (evento.Id > 0) {
124
- this.modalCtrl.dismiss({ Id: evento.Id });
125
- }
126
- }
127
-
128
- expandir() {
129
- this.treeView.expandir();
130
- }
131
-
132
- //utils
133
- async showLoading(msg: string, cancelable: boolean = false): Promise<HTMLIonLoadingElement> {
134
- const loading = await this.loadingCtrl.create({
135
- message: msg,
136
- backdropDismiss: cancelable
137
- //duration: 2000
138
- });
139
- /*
140
- loading.onDidDismiss().then(() => {
141
- console.log('loading dissmissed', request);
142
- if (request.subscription) {
143
- request.subscription.unsubscribe();
144
- }
145
- });
146
- */
147
- await loading.present();
148
- return loading;
149
-
150
- }
151
-
152
- }
@@ -1,96 +0,0 @@
1
- <div style="position: relative; height: auto; padding-left: 2%; background-color: white;">
2
-
3
- <div *ngIf="arvore" [class]="caixaClass" style="padding-left: 6px; font-size: 12px;">
4
- <!-- raiz -->
5
- <div *ngFor="let raiz of arvore" class="coluna">
6
- <kb-tree-view-nivel [nivel]="0" [node]="raiz" [currentSearch]="currentSearch" (nivelClick)="raiz.Clicable === true ? carregarRegistro(raiz) : null">
7
- </kb-tree-view-nivel>
8
-
9
- <div *ngIf="raiz.Expandido" class="filho">
10
- <div *ngFor="let nivel1 of raiz.Filhos" draggable="true">
11
- <kb-tree-view-nivel [nivel]="1" [node]="nivel1" [currentSearch]="currentSearch" (nivelClick)="nivel1.Clicable === true ? carregarRegistro(nivel1): null">
12
- </kb-tree-view-nivel>
13
-
14
- <div *ngIf="nivel1 && nivel1.Expandido" class="filho">
15
- <div *ngFor="let nivel2 of nivel1.Filhos">
16
- <kb-tree-view-nivel [nivel]="2" [node]="nivel2" [currentSearch]="currentSearch" (nivelClick)="nivel2.Clicable === true ? carregarRegistro(nivel2): null">
17
- </kb-tree-view-nivel>
18
-
19
- <div *ngIf="nivel2 && nivel2.Expandido" class="filho">
20
- <div *ngFor="let nivel3 of nivel2.Filhos">
21
- <kb-tree-view-nivel [nivel]="3" [node]="nivel3" [currentSearch]="currentSearch" (nivelClick)="nivel3.Clicable === true ? carregarRegistro(nivel3): null">
22
- </kb-tree-view-nivel>
23
-
24
- <div *ngIf="nivel3 && nivel3.Expandido" class="filho">
25
- <div *ngFor="let nivel4 of nivel3.Filhos">
26
- <kb-tree-view-nivel [nivel]="4" [node]="nivel4" [currentSearch]="currentSearch" (nivelClick)="nivel4.Clicable === true ? carregarRegistro(nivel4): null">
27
- </kb-tree-view-nivel>
28
-
29
- <div *ngIf="nivel4 && nivel4.Expandido" class="filho">
30
- <div *ngFor="let nivel5 of nivel4.Filhos">
31
- <kb-tree-view-nivel [nivel]="5" [node]="nivel5" [currentSearch]="currentSearch"
32
- (nivelClick)="nivel5.Clicable === true ? carregarRegistro(nivel5): null"></kb-tree-view-nivel>
33
-
34
- <div *ngIf="nivel5 && nivel5.Expandido" class="filho">
35
- <div *ngFor="let nivel6 of nivel5.Filhos">
36
- <kb-tree-view-nivel [nivel]="6" [node]="nivel6" [currentSearch]="currentSearch"
37
- (nivelClick)="nivel6.Clicable === true ? carregarRegistro(nivel6): null"></kb-tree-view-nivel>
38
-
39
- <div *ngIf="nivel6 && nivel6.Expandido" class="filho">
40
- <div *ngFor="let nivel7 of nivel6.Filhos">
41
- <kb-tree-view-nivel [nivel]="7" [node]="nivel7" [currentSearch]="currentSearch"
42
- (nivelClick)="nivel7.Clicable === true ? carregarRegistro(nivel7): null"></kb-tree-view-nivel>
43
-
44
- <div *ngIf="nivel7 && nivel7.Expandido" class="filho">
45
- <div *ngFor="let nivel8 of nivel7.Filhos">
46
- <kb-tree-view-nivel [nivel]="8" [node]="nivel8"
47
- (nivelClick)="nivel8.Clicable === true ? carregarRegistro(nivel8): null"></kb-tree-view-nivel>
48
-
49
- <div *ngIf="nivel8 && nivel8.Expandido" class="filho">
50
- <div *ngFor="let nivel9 of nivel8.Filhos">
51
- <kb-tree-view-nivel [nivel]="9" [node]="nivel9" [currentSearch]="currentSearch"
52
- (nivelClick)="nivel9.Clicable === true ? carregarRegistro(nivel9): null"></kb-tree-view-nivel>
53
-
54
- <div *ngIf="nivel9 && nivel9.Expandido" class="filho">
55
- <div *ngFor="let nivel10 of nivel9.Filhos">
56
- <kb-tree-view-nivel [nivel]="10" [node]="nivel10" [currentSearch]="currentSearch"
57
- (nivelClick)="nivel10.Clicable === true ? carregarRegistro(nivel10): null"></kb-tree-view-nivel>
58
-
59
- </div>
60
-
61
- </div>
62
- </div>
63
-
64
- </div>
65
-
66
-
67
- </div>
68
-
69
- </div>
70
- </div>
71
-
72
- </div>
73
- </div>
74
-
75
- </div>
76
- </div>
77
-
78
- </div>
79
- </div>
80
-
81
- </div>
82
- </div>
83
-
84
- </div>
85
-
86
-
87
-
88
- </div>
89
-
90
- </div>
91
-
92
- </div>
93
-
94
- </div>
95
- </div>
96
- </div>
@@ -1,50 +0,0 @@
1
- .boxSeta {
2
- margin: 2px;
3
- font-size: large;
4
- color: rgb(9, 69, 158);
5
- cursor: pointer;
6
- }
7
- .caixa{
8
- border: 2px transparent solid;
9
- padding: 3px;
10
- //height: 560px;
11
- width: 100%;
12
- position: relative;
13
- overflow-y: auto;
14
- background-color: white;
15
- border-radius: 5px;
16
- height: 100%;
17
- }
18
- .coluna{
19
- padding-bottom: 10px;
20
- }
21
-
22
- .filho{
23
- padding-top: 6px;
24
- }
25
-
26
- .node-link {
27
- cursor: pointer;
28
- }
29
-
30
- .caixa-agrupado{
31
- border: 2px transparent solid;
32
- padding: 3px;
33
- height: 701px;
34
- width: 100%;
35
- position: relative;
36
- overflow-y: auto;
37
- border-radius: 5px;
38
- background-color: white;
39
- }
40
-
41
- .caixa-empresa{
42
- border: 2px transparent solid;
43
- padding: 3px;
44
- height: 340px;
45
- width: 100%;
46
- position: relative;
47
- overflow-y: auto;
48
- border-radius: 5px;
49
- background-color: white;
50
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { TreeViewComponent } from './tree-view.component';
4
-
5
- describe('TreeViewComponent', () => {
6
- let component: TreeViewComponent;
7
- let fixture: ComponentFixture<TreeViewComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [TreeViewComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(TreeViewComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,92 +0,0 @@
1
- import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2
- import { Tree } from 'appproject-lib';
3
-
4
- @Component({
5
- selector: 'kb-tree-view',
6
- templateUrl: './tree-view.component.html',
7
- styleUrl: './tree-view.component.scss'
8
- })
9
- export class TreeViewComponent implements OnInit{
10
- @Input() itens: any[] = [];
11
- @Input() campoId: string;
12
- @Input() campoPai: string;
13
- @Input() campoLabel: string;
14
- @Input() cadastro: string;
15
- //sera o nome da chamada put, ex: [endpoint: CentroCustoPai]/id/pai
16
- @Input() endpoint: string;
17
- @Input() caixaClass: string = 'caixa';
18
- @Output() beforeUpdate = new EventEmitter();
19
- @Input() currentSearch: string;
20
- @Output() selecionarRegistro = new EventEmitter();
21
-
22
- arvore: Tree[] = [];
23
-
24
- ngOnInit(): void {
25
- //throw new Error('Method not implemented.');
26
- }
27
-
28
- montaArvore(pai: number, arvore: Tree[]): number {
29
- if (arvore && arvore.length > 0) {
30
- //procurar os filhos de cada no
31
- arvore.forEach(f => {
32
- //console.log('no atual:', f, );
33
- let filhos = this.itens.filter(i => i[this.campoPai] == f.Id);
34
- //console.log('filhos atual:', filhos);
35
- f.Filhos = [];
36
- filhos.forEach(fi => {
37
- f.Filhos.push({ Id: fi[this.campoId], Pai: f.Id, Label: fi[this.campoLabel], Filhos: [], Expandido: false, Clicable: (fi['ClicableTree'] == null || fi['ClicableTree'] === true) });
38
- });
39
- return this.montaArvore(0, f.Filhos);
40
- });
41
- return 0;
42
- } else {
43
- //console.log('sem filhos');
44
- return 0;
45
- }
46
- }
47
-
48
- arvoreClick(before: boolean = true) {
49
- if (this.beforeUpdate && before) {
50
- this.beforeUpdate.emit();
51
- return;
52
- }
53
- this.arvore = [];
54
- //console.log('tree itens', this.itens);
55
- if (this.itens && this.itens.length > 0) {
56
- //montar arvore pais
57
- this.itens.forEach(it => {
58
- if (it[this.campoPai] == null) {
59
- //é pai
60
- this.arvore.push({ Id: it[this.campoId], Pai: null, Label: it[this.campoLabel], Filhos: [], Expandido: false, Clicable: (it['ClicableTree'] == null || it['ClicableTree'] === true) });
61
-
62
- }
63
- })
64
- this.montaArvore(0, this.arvore);
65
-
66
- console.log('arvore', this.arvore);
67
- }
68
- }
69
-
70
- expandir(arvore: Tree[] = null): number {
71
- if (arvore == null) {
72
- arvore = this.arvore;
73
- }
74
- if (arvore && arvore.length > 0) {
75
- //procurar os filhos de cada no
76
- arvore.forEach(f => {
77
- //expandir
78
- f.Expandido = true;
79
- return this.expandir(f.Filhos);
80
- });
81
- return 0;
82
- } else {
83
- //console.log('sem filhos');
84
- return 0;
85
- }
86
- }
87
-
88
- carregarRegistro(node: Tree) {
89
- console.log('carrega registro', node);
90
- this.selecionarRegistro.next({ Cadastro: this.cadastro, Id: node.Id });
91
- }
92
- }
@@ -1,17 +0,0 @@
1
- <span [innerHtml]="identacao" class="node-link"></span>
2
- <!-- mostrar a seta se tiver filhos ou se for raiz (nivel = 0)-->
3
- <span class="node-link" *ngIf="!node.Expandido && (node.Filhos.length > 0 || nivel == 0)" (click)="node.Expandido = !node.Expandido"
4
- class="boxSeta">
5
- <ion-icon name="chevron-forward-outline"></ion-icon>
6
- </span>
7
- <span class="node-link" *ngIf="node.Expandido" (click)="node.Expandido = !node.Expandido" class="boxSeta">
8
- <ion-icon name="chevron-down-outline"></ion-icon>
9
- </span>
10
- <!--
11
- <span *ngIf="!node.Expandido">&nbsp;&nbsp;&nbsp;</span>
12
- -->
13
-
14
- <!--
15
- <span [class]="{ 'node-link' : node.Clicable === true, 'node-disabled': node.Clicable === false }" (click)="nodeClick()" title="{{ node.Label }}"> {{ node.Label }}</span>
16
- -->
17
- <span [class]="{ 'node-link' : node.Clicable === true, 'node-disabled': node.Clicable === false }" (click)="nodeClick()" title="{{ node.Label }}" [innerHTML]="highlight(node.Label)"></span>
@@ -1,8 +0,0 @@
1
- .node-link {
2
- cursor: pointer;
3
- }
4
-
5
- .node-disabled {
6
- cursor: auto;
7
- color: darkgray;
8
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { TreeViewNivelComponent } from './tree-view-nivel.component';
4
-
5
- describe('TreeViewNivelComponent', () => {
6
- let component: TreeViewNivelComponent;
7
- let fixture: ComponentFixture<TreeViewNivelComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [TreeViewNivelComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(TreeViewNivelComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,43 +0,0 @@
1
- import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2
- import { DomSanitizer } from '@angular/platform-browser';
3
-
4
- @Component({
5
- selector: 'kb-tree-view-nivel',
6
- templateUrl: './tree-view-nivel.component.html',
7
- styleUrl: './tree-view-nivel.component.scss'
8
- })
9
- export class TreeViewNivelComponent implements OnInit {
10
- @Output() nivelClick = new EventEmitter();
11
- @Input() node: any;
12
- @Input() nivel: number;
13
- @Input() currentSearch: string;
14
-
15
- identacao: string = '';
16
-
17
- constructor(private sanitizer: DomSanitizer) { }
18
-
19
- ngOnInit() {
20
- for (let i=0; i<this.nivel;i++) {
21
- this.identacao += '<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>';
22
- }
23
- //console.log('IDENT', this.identacao)
24
- }
25
-
26
- nodeClick() {
27
- if (this.nivelClick) {
28
- this.nivelClick.emit(this.node);
29
- }
30
- }
31
-
32
- highlight(texto: string): any {
33
- if (!this.currentSearch)
34
- return texto;
35
- let index = texto.toLowerCase().indexOf(this.currentSearch.toLowerCase());
36
- //console.log(index);
37
- if (index >= 0) {
38
- return this.sanitizer.bypassSecurityTrustHtml(texto.substring(0, index) + '<strong style="background-color: yellow !important;">' + texto.substring(index, index + this.currentSearch.length) + '</strong>' + texto.substring(index + this.currentSearch.length)); //texto.replace(this.textoPesquisa, `<strong>${this.textoPesquisa}</strong>`);
39
- } else {
40
- return texto;
41
- }
42
- }
43
- }
package/src/test.ts DELETED
@@ -1,15 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'zone.js';
4
- import 'zone.js/testing';
5
- import { getTestBed } from '@angular/core/testing';
6
- import {
7
- BrowserDynamicTestingModule,
8
- platformBrowserDynamicTesting
9
- } from '@angular/platform-browser-dynamic/testing';
10
-
11
- // First, initialize the Angular testing environment.
12
- getTestBed().initTestEnvironment(
13
- BrowserDynamicTestingModule,
14
- platformBrowserDynamicTesting(),
15
- );
package/tsconfig.lib.json DELETED
@@ -1,15 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/lib",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "inlineSources": true,
9
- "types": []
10
- },
11
- "exclude": [
12
- "src/test.ts",
13
- "**/*.spec.ts"
14
- ]
15
- }
@@ -1,10 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.lib.json",
4
- "compilerOptions": {
5
- "declarationMap": false
6
- },
7
- "angularCompilerOptions": {
8
- "compilationMode": "partial"
9
- }
10
- }
@@ -1,17 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/spec",
6
- "types": [
7
- "jasmine"
8
- ]
9
- },
10
- "files": [
11
- "src/test.ts"
12
- ],
13
- "include": [
14
- "**/*.spec.ts",
15
- "**/*.d.ts"
16
- ]
17
- }