libey-ng-component-library 0.0.35 → 0.0.37

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 (69) hide show
  1. package/bundles/libey-ng-component-library.umd.js +2521 -0
  2. package/bundles/libey-ng-component-library.umd.js.map +1 -0
  3. package/esm2015/lib/cpm-indicator/libey-ng-cpm-indicator.component.js +193 -0
  4. package/esm2015/lib/cpm-indicator/libey-ng-cpm-indicator.module.js +26 -0
  5. package/esm2015/lib/icons/icons.module.js +26 -0
  6. package/esm2015/lib/icons/libey-ng-icons/libey-ng-icons.component.js +52 -0
  7. package/esm2015/lib/libey-ng-component-library.component.js +26 -0
  8. package/esm2015/lib/libey-ng-component-library.module.js +60 -0
  9. package/esm2015/lib/libey-ng-component-library.service.js +14 -0
  10. package/esm2015/lib/signature/libey-ng-signature/libey-ng-signature.component.js +197 -0
  11. package/esm2015/lib/signature/libey-ng-signature.module.js +57 -0
  12. package/esm2015/lib/table/directives/libey-column.directive.js +59 -0
  13. package/esm2015/lib/table/libey-ng-table.component.js +249 -0
  14. package/esm2015/lib/table/libey-ng-table.module.js +21 -0
  15. package/esm2015/libey-ng-component-library.js +5 -0
  16. package/esm2015/public-api.js +23 -0
  17. package/esm2015/utils/CpmIndicator/cpm-indicator-types.js +25 -0
  18. package/esm2015/utils/SigWeb/SigWeb.js +1442 -0
  19. package/fesm2015/libey-ng-component-library.js +2416 -0
  20. package/fesm2015/libey-ng-component-library.js.map +1 -0
  21. package/lib/cpm-indicator/libey-ng-cpm-indicator.component.d.ts +66 -0
  22. package/lib/cpm-indicator/libey-ng-cpm-indicator.module.d.ts +8 -0
  23. package/lib/icons/icons.module.d.ts +8 -0
  24. package/lib/icons/libey-ng-icons/libey-ng-icons.component.d.ts +19 -0
  25. package/lib/libey-ng-component-library.component.d.ts +8 -0
  26. package/lib/libey-ng-component-library.module.d.ts +13 -0
  27. package/lib/libey-ng-component-library.service.d.ts +6 -0
  28. package/lib/signature/libey-ng-signature/libey-ng-signature.component.d.ts +40 -0
  29. package/lib/signature/libey-ng-signature.module.d.ts +13 -0
  30. package/lib/table/directives/libey-column.directive.d.ts +24 -0
  31. package/lib/table/libey-ng-table.component.d.ts +64 -0
  32. package/lib/table/libey-ng-table.module.d.ts +10 -0
  33. package/libey-ng-component-library.d.ts +5 -0
  34. package/package.json +24 -17
  35. package/{src/public-api.ts → public-api.d.ts} +0 -4
  36. package/utils/CpmIndicator/cpm-indicator-types.d.ts +40 -0
  37. package/utils/SigWeb/SigWeb.d.ts +219 -0
  38. package/karma.conf.js +0 -44
  39. package/ng-package.json +0 -13
  40. package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.css +0 -216
  41. package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.html +0 -201
  42. package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.spec.ts +0 -25
  43. package/src/lib/cpm-indicator/libey-ng-cpm-indicator.component.ts +0 -203
  44. package/src/lib/cpm-indicator/libey-ng-cpm-indicator.module.ts +0 -19
  45. package/src/lib/icons/icons.component.css +0 -9
  46. package/src/lib/icons/icons.module.ts +0 -16
  47. package/src/lib/icons/libey-ng-icons/libey-ng-icons.component.html +0 -1831
  48. package/src/lib/icons/libey-ng-icons/libey-ng-icons.component.ts +0 -36
  49. package/src/lib/libey-ng-component-library.component.spec.ts +0 -25
  50. package/src/lib/libey-ng-component-library.component.ts +0 -20
  51. package/src/lib/libey-ng-component-library.module.ts +0 -32
  52. package/src/lib/libey-ng-component-library.service.spec.ts +0 -16
  53. package/src/lib/libey-ng-component-library.service.ts +0 -9
  54. package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.css +0 -7
  55. package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.html +0 -41
  56. package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.spec.ts +0 -25
  57. package/src/lib/signature/libey-ng-signature/libey-ng-signature.component.ts +0 -214
  58. package/src/lib/signature/libey-ng-signature.module.ts +0 -30
  59. package/src/lib/table/directives/libey-column.directive.ts +0 -29
  60. package/src/lib/table/libey-ng-table.component.css +0 -249
  61. package/src/lib/table/libey-ng-table.component.html +0 -122
  62. package/src/lib/table/libey-ng-table.component.ts +0 -234
  63. package/src/lib/table/libey-ng-table.module.ts +0 -13
  64. package/src/test.ts +0 -28
  65. package/src/utils/CpmIndicator/cpm-indicator-types.ts +0 -63
  66. package/src/utils/SigWeb/SigWeb.ts +0 -1906
  67. package/tsconfig.lib.json +0 -20
  68. package/tsconfig.lib.prod.json +0 -10
  69. package/tsconfig.spec.json +0 -17
@@ -1,36 +0,0 @@
1
- import { Component, Input, OnInit } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'lib-libey-ng-icons',
5
- templateUrl: './libey-ng-icons.component.html',
6
- styleUrls: ['../icons.component.css']
7
- })
8
- export class LibeyNgIconsComponent implements OnInit {
9
- @Input() color: string = "#224051";
10
- @Input() bgColorHover: string = "transparent";
11
- @Input() borderColor: string = "transparent";
12
- @Input() borderColorHover: string = "transparent";
13
- @Input() icon: string = "";
14
-
15
- @Input() width: number = 30;
16
- @Input() height: number = 30;
17
- @Input() activeHover: boolean = false;
18
-
19
- hover: boolean = false;
20
-
21
- constructor() { }
22
-
23
- ngOnInit(): void {
24
- }
25
-
26
- onMouseEnter() {
27
- if (this.activeHover)
28
- this.hover = true;
29
- }
30
-
31
- onMouseLeave() {
32
- this.hover = false;
33
- }
34
-
35
-
36
- }
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { LibeyNgComponentLibraryComponent } from './libey-ng-component-library.component';
4
-
5
- describe('LibeyNgComponentLibraryComponent', () => {
6
- let component: LibeyNgComponentLibraryComponent;
7
- let fixture: ComponentFixture<LibeyNgComponentLibraryComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ LibeyNgComponentLibraryComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(LibeyNgComponentLibraryComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,20 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'lib-libey-ngComponent-library',
5
- template: `
6
- <p>
7
- libey-ng-component-library works!
8
- </p>
9
- `,
10
- styles: [
11
- ]
12
- })
13
- export class LibeyNgComponentLibraryComponent implements OnInit {
14
-
15
- constructor() { }
16
-
17
- ngOnInit(): void {
18
- }
19
-
20
- }
@@ -1,32 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CommonModule, DatePipe } from '@angular/common';
3
- import { FormsModule } from '@angular/forms';
4
- import { LibeyNgTableModule } from './table/libey-ng-table.module';
5
- import { LibeyNgSignatureModule } from './signature/libey-ng-signature.module';
6
- import { SignaturePadModule } from 'angular2-signaturepad';
7
- import { IconsModule } from './icons/icons.module';
8
- import { LibeyNgCpmIndicatorModule } from './cpm-indicator/libey-ng-cpm-indicator.module';
9
-
10
-
11
- @NgModule({
12
- declarations: [
13
- ],
14
- imports: [
15
- CommonModule,
16
- FormsModule,
17
- LibeyNgTableModule,
18
- LibeyNgSignatureModule,
19
- SignaturePadModule,
20
- IconsModule,
21
- LibeyNgCpmIndicatorModule,
22
- ],
23
- exports: [
24
- LibeyNgTableModule,
25
- LibeyNgSignatureModule,
26
- SignaturePadModule,
27
- IconsModule,
28
- LibeyNgCpmIndicatorModule
29
- ],
30
- providers: [DatePipe]
31
- })
32
- export class LibeyNgComponentLibraryModule { }
@@ -1,16 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
-
3
- import { LibeyNgComponentLibraryService } from './libey-ng-component-library.service';
4
-
5
- describe('LibeyNgComponentLibraryService', () => {
6
- let service: LibeyNgComponentLibraryService;
7
-
8
- beforeEach(() => {
9
- TestBed.configureTestingModule({});
10
- service = TestBed.inject(LibeyNgComponentLibraryService);
11
- });
12
-
13
- it('should be created', () => {
14
- expect(service).toBeTruthy();
15
- });
16
- });
@@ -1,9 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
-
3
- @Injectable({
4
- providedIn: 'root'
5
- })
6
- export class LibeyNgComponentLibraryService {
7
-
8
- constructor() { }
9
- }
@@ -1,7 +0,0 @@
1
- .container {
2
- display: flex;
3
- flex-direction: column;
4
- align-items: center;
5
- justify-content: center;
6
- text-align: center;
7
- }
@@ -1,41 +0,0 @@
1
- <div class="mb-3">
2
- <div class="row mb-5">
3
- <div class="col-md-12 justify-align-center mb-3">
4
- <input type="file" (change)="fileEvent($event)" [(ngModel)]="File" class="form-control form-control-ph"
5
- accept="image/png, image/jpeg" style="border: none; min-width: 410px; width: auto;">
6
- <label *ngIf="FileValidated" [ngClass]="'text-danger'">Archivo requerido. Formatos permitidos (jpeg, jpg, png)</label>
7
- </div>
8
- <div class="col-md-12">
9
- <ng-select [(ngModel)]="DeviceType" class="ng-select-single ng-select-border-0" placeholder="Seleccionar" [clearable]="false"
10
- (change)="ChangeDevice()">
11
- <ng-option [value]="'pinpad'">Pinpad</ng-option>
12
- <ng-option [value]="'mousepad'">Mousepad</ng-option>
13
- </ng-select>
14
- <label *ngIf="NotDriver" [ngClass]="'text-danger'">No tiene el driver instalado</label>
15
- </div>
16
- </div>
17
-
18
- <div *ngIf="UploadFile==null">
19
- <div *ngIf="DeviceType=='pinpad'" style="border: 1px ridge #D6DEE5;border-radius: 10px; width: 440px;">
20
- <canvas (click)="onSign()" #sigImg [width]="widthView" [height]="heightView"></canvas>
21
- </div>
22
- <div *ngIf="DeviceType=='mousepad'" style="border: 1px ridge #D6DEE5;border-radius: 10px; width: 440px;">
23
- <signature-pad [options]="signaturePadOptions"></signature-pad>
24
- </div>
25
- </div>
26
- <div *ngIf="UploadFile!=null" style="border: 1px ridge #D6DEE5;border-radius: 10px; width: 440px;">
27
- <img [src]="UploadFile" [width]="widthView" [height]="heightView" />
28
- </div>
29
-
30
- <div class="col-md-12 mt-3">
31
- <button type="button" class="btn btn-light-primary-sm border-none text-black" (click)="onClear()">
32
- <i class="icon-trash-blue me-3"></i> Borrar firma
33
- </button>
34
- </div>
35
- </div>
36
-
37
- <div class="modal-footer">
38
- <button type="button" class="btn btn-primary btn-save-rp" (click)="onDone()">
39
- <i class="icon-save-white"></i> Guardar
40
- </button>
41
- </div>
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { LibeyNgSignatureComponent } from './libey-ng-signature.component';
4
-
5
- describe('LibeyNgSignatureComponent', () => {
6
- let component: LibeyNgSignatureComponent;
7
- let fixture: ComponentFixture<LibeyNgSignatureComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ LibeyNgSignatureComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(LibeyNgSignatureComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,214 +0,0 @@
1
- import {
2
- AfterViewInit,
3
- Component,
4
- ElementRef,
5
- OnDestroy,
6
- ViewChild,
7
- Output,
8
- EventEmitter,
9
- Input,
10
- } from '@angular/core';
11
- import { SigWebTablet } from '../../../utils/SigWeb/SigWeb';
12
- import { Form, FormBuilder, FormControl, FormGroup } from '@angular/forms';
13
- import { Subject } from 'rxjs';
14
- import { SignaturePad } from 'angular2-signaturepad';
15
- interface IOutputMessage {
16
- bioSigData: string;
17
- sigImgData: string;
18
- sigString: string;
19
- }
20
-
21
- class OutputMessage implements IOutputMessage {
22
- bioSigData: string;
23
- sigImgData: string;
24
- sigString: string;
25
- }
26
-
27
- @Component({
28
- selector: 'lib-libey-ng-signature',
29
- templateUrl: './libey-ng-signature.component.html',
30
- styleUrls: ['./libey-ng-signature.component.css'],
31
- })
32
- export class LibeyNgSignatureComponent implements AfterViewInit, OnDestroy {
33
- @Output() OutputSignature = new EventEmitter<IOutputMessage>();
34
- @Input() DeviceType: string = 'mousepad';
35
-
36
- private _destroy$: Subject<boolean> = new Subject<boolean>();
37
- @ViewChild('sigImg', { static: false })
38
- canvas!: ElementRef<HTMLCanvasElement>;
39
- @ViewChild(SignaturePad) signaturePad: SignaturePad;
40
- cnvContext: CanvasRenderingContext2D;
41
- tmr: any;
42
- widthView: number = 440;
43
- heightView: number = 250;
44
- widthRender: number = 440;
45
- heightRender: number = 250;
46
- signaturePadOptions: Object = {
47
- minWidth: 5,
48
- canvasWidth: this.widthView,
49
- canvasHeight: this.heightView,
50
- };
51
- FileValidated = false;
52
- NotDriver = false;
53
- UploadFile: string = null;
54
- File: any;
55
- constructor() {}
56
-
57
- ngAfterViewInit(): void {
58
- this.InitDevice();
59
- }
60
-
61
- ngOnDestroy(): void {
62
- this.closingSigWeb();
63
- this._destroy$.next(true);
64
- }
65
-
66
- ChangeDevice() {
67
- this.NotDriver = false;
68
- this.UploadFile = null;
69
- this.File = null;
70
- setTimeout(() => {
71
- this.InitDevice();
72
- }, 200);
73
- }
74
-
75
- InitDevice() {
76
- if (this.DeviceType == 'pinpad') {
77
- this.cnvContext = (<HTMLCanvasElement>(
78
- this.canvas.nativeElement
79
- )).getContext('2d');
80
- }
81
- if (this.DeviceType == 'mousepad') {
82
- this.signaturePad.set('minWidth', 5);
83
- this.signaturePad.clear();
84
- }
85
- }
86
-
87
- closingSigWeb() {
88
- SigWebTablet.ClearTablet();
89
- SigWebTablet.SetTabletState(0, this.tmr, null);
90
- }
91
-
92
- onSign() {
93
- this.NotDriver = false;
94
- this.UploadFile = null;
95
- var driver = SigWebTablet.GetVersionString();
96
- if(driver == null){
97
- this.NotDriver = true;
98
- }else{
99
- this.NotDriver = false;
100
- console.log('onSign Clicked!');
101
- SigWebTablet.SetDisplayXSize(this.widthRender);
102
- SigWebTablet.SetDisplayYSize(this.heightRender);
103
- SigWebTablet.SetTabletState(0, this.tmr, null);
104
- SigWebTablet.SetJustifyMode(0);
105
- SigWebTablet.ClearTablet();
106
-
107
- if (this.tmr == null) {
108
- this.tmr = SigWebTablet.SetTabletState(1, this.cnvContext, 50);
109
- } else {
110
- SigWebTablet.SetTabletState(0, this.tmr, null);
111
- this.tmr = null;
112
- this.tmr = SigWebTablet.SetTabletState(1, this.cnvContext, 50);
113
- }
114
- }
115
- }
116
-
117
- onClear() {
118
- if(this.UploadFile == null){
119
- if (this.DeviceType == 'pinpad') {
120
- SigWebTablet.ClearTablet();
121
- if (this.cnvContext) {
122
- this.cnvContext.clearRect(
123
- 0,
124
- 0,
125
- this.canvas.nativeElement.width,
126
- this.canvas.nativeElement.height
127
- );
128
- }
129
- }
130
- if (this.DeviceType == 'mousepad') {
131
- this.signaturePad.clear();
132
- }
133
- }else{
134
- this.File = null;
135
- this.UploadFile = null;
136
- this.ChangeDevice();
137
- }
138
- }
139
-
140
- onDone() {
141
- var result = new OutputMessage();
142
- if(this.UploadFile == null){
143
- if (this.DeviceType == 'pinpad') {
144
- // if (Number(SigWebTablet.NumberOfTabletPoints()) === 0) {
145
- // alert('Por favor firme antes de continuar');
146
- // } else {
147
- SigWebTablet.SetTabletState(0, this.tmr, null);
148
-
149
- SigWebTablet.SetSigCompressionMode(1);
150
- result.bioSigData = SigWebTablet.GetSigString();
151
- result.sigImgData = SigWebTablet.GetSigString();
152
- SigWebTablet.SetImageXSize(this.widthRender);
153
- SigWebTablet.SetImageYSize(this.heightRender);
154
- SigWebTablet.SetImagePenWidth(5);
155
- SigWebTablet.GetSigImageB64((base64: string) => {
156
- result.sigString = "data:image/png;base64," + base64;
157
- this.OutputSignature.emit(result);
158
- });
159
- // }
160
- }
161
- if (this.DeviceType == 'mousepad') {
162
- var result = new OutputMessage();
163
- result.sigString = this.signaturePad.toDataURL();
164
- this.OutputSignature.emit(result);
165
- }
166
- }else{
167
- result.sigString = this.UploadFile;
168
- this.OutputSignature.emit(result);
169
- }
170
- }
171
- fileEvent(event: any) {
172
- this.UploadFile = null;
173
- this.FileValidated = false;
174
- const file = event.target.files[0];
175
- if (file.type == 'image/jpeg' || file.type == 'image/png') {
176
- this.FileValidated = false;
177
- const newWidth = this.widthRender;
178
- const newHeight = this.heightRender;
179
- this.resizeImage(file, newWidth, newHeight)
180
- .then((resizedImageDataUrl) => {
181
- this.UploadFile = resizedImageDataUrl;
182
- })
183
- .catch((error) => {
184
- console.error('Error al redimensionar la imagen:', error);
185
- });
186
- }else{
187
- this.File = null;
188
- this.UploadFile = null;
189
- this.FileValidated = true;
190
- }
191
- }
192
- resizeImage(image: File, newWidth: number, newHeight: number): Promise<string> {
193
- return new Promise((resolve, reject) => {
194
- const reader = new FileReader();
195
- reader.onload = (e) => {
196
- const img = new Image();
197
- img.src = e.target.result as string;
198
- img.onload = () => {
199
- const canvas = document.createElement('canvas');
200
- const ctx = canvas.getContext('2d');
201
- canvas.width = newWidth;
202
- canvas.height = newHeight;
203
- ctx.drawImage(img, 0, 0, newWidth, newHeight);
204
- const resizedImageDataUrl = canvas.toDataURL(image.type);
205
- resolve(resizedImageDataUrl);
206
- };
207
- img.onerror = (error) => {
208
- reject(error);
209
- };
210
- };
211
- reader.readAsDataURL(image);
212
- });
213
- }
214
- }
@@ -1,30 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4
- import { LibeyNgSignatureComponent } from './libey-ng-signature/libey-ng-signature.component';
5
- import { SignaturePadModule } from 'angular2-signaturepad';
6
- import { NgSelectModule } from '@ng-select/ng-select';
7
- import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
8
- import { IconsModule } from '../icons/icons.module';
9
-
10
- @NgModule({
11
- declarations: [
12
- LibeyNgSignatureComponent
13
- ],
14
- imports: [
15
- FormsModule,
16
- ReactiveFormsModule,
17
- SignaturePadModule,
18
- CommonModule,
19
- NgSelectModule,
20
- NgbModule
21
- ],
22
- exports: [
23
- LibeyNgSignatureComponent,
24
- SignaturePadModule,
25
- NgSelectModule,
26
- NgbModule,
27
- IconsModule
28
- ]
29
- })
30
- export class LibeyNgSignatureModule { }
@@ -1,29 +0,0 @@
1
- import { ContentChild, Directive, Input, TemplateRef } from '@angular/core';
2
-
3
- @Directive({
4
- selector: 'libey-ng-column'
5
- })
6
- export class LibeyColumnDirective {
7
- @Input() header!: string;
8
- @Input() property!: string;
9
- @Input() width!: number;
10
- @Input() view: boolean = true;
11
- @Input() arrayMap?: string;
12
- @Input() isArray?: boolean;
13
- @Input() expandable?: boolean;
14
- @Input() class?: string;
15
- @Input() classHeader?: string;
16
- @Input() childTableTemplate: TemplateRef<any>;
17
- @Input() isAutoClose: (item: any) => boolean = () => true;
18
- @Input() expandedByDefault: (item: any) => boolean = () => false;
19
- @Input() rowspan: (item: any) => number = () => 0;
20
- @Input() isRowspan?: boolean;
21
- @ContentChild('headerTemplate', { static: true }) headerTemplate: TemplateRef<any>;
22
- @ContentChild('cellTemplate', { static: true }) cellTemplate: TemplateRef<any>;
23
- @ContentChild(TemplateRef, { static: true }) defaultTemplate: TemplateRef<any>;
24
- getCellTemplate(): TemplateRef<any> {
25
- return this.cellTemplate || this.defaultTemplate;
26
- }
27
-
28
-
29
- }