libey-ng-component-library 0.0.18 → 0.0.20

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,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms')) :
3
- typeof define === 'function' && define.amd ? define('libey-ng-component-library', ['exports', '@angular/core', '@angular/common', '@angular/forms'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["libey-ng-component-library"] = {}, global.ng.core, global.ng.common, global.ng.forms));
5
- })(this, (function (exports, i0, i1, forms) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('rxjs'), require('angular2-signaturepad'), require('@ng-select/ng-select'), require('@ng-bootstrap/ng-bootstrap'), require('@popperjs/core')) :
3
+ typeof define === 'function' && define.amd ? define('libey-ng-component-library', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'rxjs', 'angular2-signaturepad', '@ng-select/ng-select', '@ng-bootstrap/ng-bootstrap', '@popperjs/core'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["libey-ng-component-library"] = {}, global.ng.core, global.ng.common, global.ng.forms, global.rxjs, global.i1, global.i2, global.ngBootstrap, global.core));
5
+ })(this, (function (exports, i0, i1$1, i4, rxjs, i1, i2, ngBootstrap, core) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -23,7 +23,10 @@
23
23
  }
24
24
 
25
25
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
26
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1$1);
27
+ var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
28
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1);
29
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
27
30
 
28
31
  var LibeyNgComponentLibraryService = /** @class */ (function () {
29
32
  function LibeyNgComponentLibraryService() {
@@ -360,42 +363,1750 @@
360
363
  return LibeyNgTableModule;
361
364
  }());
362
365
  LibeyNgTableModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgTableModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
363
- LibeyNgTableModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgTableModule, declarations: [LibeyNgTableComponent, LibeyColumnDirective], imports: [i1.CommonModule, forms.FormsModule], exports: [LibeyNgTableComponent, LibeyColumnDirective] });
364
- LibeyNgTableModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgTableModule, imports: [[i1.CommonModule, forms.FormsModule]] });
366
+ LibeyNgTableModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgTableModule, declarations: [LibeyNgTableComponent, LibeyColumnDirective], imports: [i1$1.CommonModule, i4.FormsModule], exports: [LibeyNgTableComponent, LibeyColumnDirective] });
367
+ LibeyNgTableModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgTableModule, imports: [[i1$1.CommonModule, i4.FormsModule]] });
365
368
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgTableModule, decorators: [{
366
369
  type: i0.NgModule,
367
370
  args: [{
368
371
  declarations: [LibeyNgTableComponent, LibeyColumnDirective],
369
- imports: [i1.CommonModule, forms.FormsModule],
372
+ imports: [i1$1.CommonModule, i4.FormsModule],
370
373
  exports: [LibeyNgTableComponent, LibeyColumnDirective]
371
374
  }]
372
375
  }] });
373
376
 
377
+ // SigWebTablet.ts
378
+ var SigWebTablet = /** @class */ (function () {
379
+ function SigWebTablet() {
380
+ }
381
+ SigWebTablet.revokeBlobURL = function (url) {
382
+ if (window.URL) {
383
+ URL.revokeObjectURL(url);
384
+ }
385
+ else if (window.webkitURL) {
386
+ webkitURL.revokeObjectURL(url);
387
+ }
388
+ };
389
+ SigWebTablet.getBlobURL = function (blob) {
390
+ if (window.URL) {
391
+ return URL.createObjectURL(blob);
392
+ }
393
+ else if (window.webkitURL) {
394
+ return webkitURL.createObjectURL(blob);
395
+ }
396
+ return ''; // Retornar un string vacío en caso de error
397
+ };
398
+ SigWebTablet.makeUri = function () {
399
+ var prot = location.protocol;
400
+ if (prot == 'file:') {
401
+ prot = 'http:';
402
+ }
403
+ if (this.isIE()) {
404
+ if (prot == 'https:') {
405
+ return prot + '//tablet.sigwebtablet.com:47290/SigWeb/';
406
+ }
407
+ else {
408
+ return prot + '//tablet.sigwebtablet.com:47289/SigWeb/';
409
+ }
410
+ }
411
+ if (this.isChrome()) {
412
+ if (prot == 'https:') {
413
+ return prot + '//tablet.sigwebtablet.com:47290/SigWeb/';
414
+ }
415
+ else {
416
+ return prot + '//tablet.sigwebtablet.com:47289/SigWeb/';
417
+ }
418
+ }
419
+ else {
420
+ //FIREFOX
421
+ if (prot == 'https:') {
422
+ return prot + '//tablet.sigwebtablet.com:47290/SigWeb/';
423
+ }
424
+ else {
425
+ return prot + '//tablet.sigwebtablet.com:47289/SigWeb/';
426
+ }
427
+ }
428
+ };
429
+ SigWebTablet.generateUUID = function () {
430
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
431
+ var r = (Math.random() * 16) | 0;
432
+ var v = c === 'x' ? r : (r & 0x3) | 0x8;
433
+ return v.toString(16);
434
+ });
435
+ };
436
+ SigWebTablet.isSigWebInstalled = function () {
437
+ var xhr = new XMLHttpRequest();
438
+ try {
439
+ xhr.open('GET', this.baseUri + "TabletState?noCache=" + this.generateUUID(), false);
440
+ xhr.send();
441
+ return xhr.status !== 404 && xhr.status !== 0;
442
+ }
443
+ catch (e) {
444
+ console.log('Error checking SigWeb installation', e);
445
+ return false;
446
+ }
447
+ };
448
+ SigWebTablet.isIE = function () {
449
+ return (navigator.appName === 'Microsoft Internet Explorer' ||
450
+ (navigator.appName === 'Netscape' &&
451
+ new RegExp('Trident/.*rv:([0-9]{1,}[.0-9]{0,})').exec(navigator.userAgent) != null));
452
+ };
453
+ SigWebTablet.isChrome = function () {
454
+ return navigator.userAgent.lastIndexOf('Chrome/') > 0;
455
+ };
456
+ SigWebTablet.SigWebcreateXHR = function () {
457
+ var xhr = new XMLHttpRequest();
458
+ if (!xhr) {
459
+ throw new Error('No se pudo crear XMLHttpRequest');
460
+ }
461
+ return xhr;
462
+ };
463
+ SigWebTablet.SigWebSetProperty = function (prop) {
464
+ var xhr = this.SigWebcreateXHR();
465
+ if (xhr) {
466
+ xhr.open('POST', this.baseUri + prop, true);
467
+ xhr.send(null);
468
+ if (xhr.readyState === 4 && xhr.status === 200) {
469
+ return xhr.responseText;
470
+ }
471
+ }
472
+ return '';
473
+ };
474
+ SigWebTablet.SigWebSetPropertySync = function (prop) {
475
+ var xhr = this.SigWebcreateXHR();
476
+ if (xhr) {
477
+ xhr.open('POST', this.baseUri + prop, false);
478
+ xhr.send();
479
+ if (xhr.readyState === 4 && xhr.status === 200) {
480
+ return xhr.responseText;
481
+ }
482
+ }
483
+ return '';
484
+ };
485
+ SigWebTablet.SigWebSetStreamProperty = function (prop, strm) {
486
+ var xhr = this.SigWebcreateXHR();
487
+ if (xhr) {
488
+ xhr.open('POST', this.baseUri + prop);
489
+ xhr.setRequestHeader('Content-Type', 'text/plain');
490
+ xhr.send(strm);
491
+ }
492
+ return '';
493
+ };
494
+ SigWebTablet.SigWebSyncSetStreamProperty = function (prop, strm) {
495
+ var xhr = this.SigWebcreateXHR();
496
+ if (xhr) {
497
+ xhr.open('POST', this.baseUri + prop, false);
498
+ xhr.setRequestHeader('Content-Type', 'text/plain');
499
+ xhr.send(strm);
500
+ if (xhr.readyState === 4 && xhr.status === 200) {
501
+ return xhr.responseText;
502
+ }
503
+ }
504
+ return '';
505
+ };
506
+ SigWebTablet.SigWebSetImageStreamProperty = function (prop, strm) {
507
+ var xhr = this.SigWebcreateXHR();
508
+ if (xhr) {
509
+ xhr.open('POST', this.baseUri + prop, false);
510
+ xhr.setRequestHeader('Content-Type', 'image/png');
511
+ xhr.send(strm);
512
+ if (xhr.readyState === 4 && xhr.status === 200) {
513
+ return xhr.responseText;
514
+ }
515
+ }
516
+ return '';
517
+ };
518
+ SigWebTablet.SigWebSetImageBlobProperty = function (prop, strm) {
519
+ var xhr = this.SigWebcreateXHR();
520
+ if (xhr) {
521
+ xhr.open('POST', this.baseUri + prop, false);
522
+ xhr.setRequestHeader('Content-Type', 'blob');
523
+ xhr.send(strm);
524
+ if (xhr.readyState == 4 && xhr.status == 200) {
525
+ return xhr.responseText;
526
+ }
527
+ }
528
+ return '';
529
+ };
530
+ SigWebTablet.SigWebGetVersion = function (prop) {
531
+ try {
532
+ var xhr = this.SigWebcreateXHR();
533
+ if (xhr) {
534
+ xhr.open('GET', this.baseUri + prop + '?noCache=' + this.generateUUID(), false);
535
+ xhr.send(null);
536
+ if (xhr.readyState == 4 && xhr.status == 200) {
537
+ return xhr.responseText;
538
+ }
539
+ }
540
+ }
541
+ catch (error) {
542
+ console.error('Error en SigWebGetVersion:', error);
543
+ return null;
544
+ }
545
+ return null;
546
+ };
547
+ SigWebTablet.SigWebGetProperty = function (prop) {
548
+ var xhr = this.SigWebcreateXHR();
549
+ if (xhr) {
550
+ xhr.open('GET', this.baseUri + prop + '?noCache=' + this.generateUUID(), false);
551
+ xhr.send(null);
552
+ if (xhr.readyState == 4 && xhr.status == 200) {
553
+ return xhr.responseText;
554
+ }
555
+ }
556
+ return '';
557
+ };
558
+ SigWebTablet.GetSigImageB64 = function (callback) {
559
+ var _this = this;
560
+ var cvs = document.createElement('canvas');
561
+ var width = this.GetImageXSize();
562
+ var height = this.GetImageYSize();
563
+ cvs.width = width == '' || width == null ? 0 : Number(width);
564
+ cvs.height = height == '' || height == null ? 0 : Number(height);
565
+ var xhr2 = new XMLHttpRequest();
566
+ xhr2.open('GET', this.baseUri + 'SigImage/1' + '?noCache=' + this.generateUUID(), true);
567
+ xhr2.responseType = 'blob';
568
+ xhr2.send(null);
569
+ xhr2.onload = function () {
570
+ var cntx = cvs.getContext('2d');
571
+ var img = new Image();
572
+ img.src = _this.getBlobURL(xhr2.response);
573
+ img.onload = function () {
574
+ cntx.drawImage(img, 0, 0);
575
+ var b64String = cvs.toDataURL('image/png');
576
+ var loc = b64String.search('base64,');
577
+ var retstring = b64String.slice(loc + 7, b64String.length);
578
+ if (callback) {
579
+ callback(retstring);
580
+ }
581
+ };
582
+ };
583
+ };
584
+ SigWebTablet.SigWebWaitForPenDown = function (callback) {
585
+ var xhr = this.SigWebcreateXHR();
586
+ if (xhr) {
587
+ xhr.open('GET', this.baseUri + 'WaitForPenDown' + '?noCache=' + this.generateUUID());
588
+ xhr.timeout = 10000;
589
+ xhr.onreadystatechange = function () {
590
+ if (xhr.readyState != 4)
591
+ return;
592
+ if (xhr.status == 200)
593
+ callback();
594
+ };
595
+ xhr.send(null);
596
+ }
597
+ };
598
+ SigWebTablet.GetSigImage = function (ctx) {
599
+ var _this = this;
600
+ var xhr2 = new XMLHttpRequest();
601
+ xhr2.open('GET', this.baseUri + 'SigImage/1' + '?noCache=' + this.generateUUID(), true);
602
+ xhr2.responseType = 'blob';
603
+ xhr2.send(null);
604
+ xhr2.onload = function () {
605
+ var img = new Image();
606
+ img.src = _this.getBlobURL(xhr2.response);
607
+ img.onload = function () {
608
+ ctx.drawImage(img, 0, 0);
609
+ _this.revokeBlobURL(img.src);
610
+ img = null;
611
+ };
612
+ };
613
+ };
614
+ SigWebTablet.SigWebSetDisplayTarget = function (obj) {
615
+ this.ctx = obj;
616
+ };
617
+ SigWebTablet.SigWebRefresh = function () {
618
+ var _this = this;
619
+ var NumPoints = Number(this.NumberOfTabletPoints());
620
+ if (NumPoints == this.NumPointsLastTime) {
621
+ return;
622
+ }
623
+ this.NumPointsLastTime = NumPoints;
624
+ var xhr2 = new XMLHttpRequest();
625
+ xhr2.open('GET', this.baseUri + 'SigImage/0' + '?noCache=' + this.generateUUID(), true);
626
+ xhr2.responseType = 'blob';
627
+ xhr2.onload = function () {
628
+ var img = new Image();
629
+ img.src = _this.getBlobURL(xhr2.response);
630
+ // img.src = window.URL.createObjectURL(xhr2.response);
631
+ img.onload = function () {
632
+ _this.ctx.drawImage(img, 0, 0);
633
+ _this.revokeBlobURL(img.src);
634
+ img = null;
635
+ };
636
+ };
637
+ xhr2.send(null);
638
+ };
639
+ SigWebTablet.SigWebEvent = function () {
640
+ var _this = this;
641
+ var OldEvStatus = this.EvStatus;
642
+ var xhr = this.SigWebcreateXHR();
643
+ if (xhr) {
644
+ xhr.open('GET', this.baseUri + 'EventStatus' + '?noCache=' + this.generateUUID(), true);
645
+ xhr.onload = function () {
646
+ _this.EvStatus = xhr.responseText;
647
+ if (OldEvStatus & 0x01 && _this.EvStatus & 0x02) {
648
+ if (_this.onSigPenDown) {
649
+ _this.onSigPenDown();
650
+ }
651
+ }
652
+ if (OldEvStatus & 0x02 && _this.EvStatus & 0x01) {
653
+ if (_this.onSigPenUp) {
654
+ _this.onSigPenUp();
655
+ }
656
+ }
657
+ };
658
+ xhr.send(null);
659
+ }
660
+ };
661
+ SigWebTablet.setSigWebFontThreshold = function (v) {
662
+ this.SigWebFontThreshold = v;
663
+ };
664
+ SigWebTablet.createLcdBitmapFromCanvas = function (ourCanvas, xp, yp, width, height) {
665
+ var canvasCtx = ourCanvas.getContext('2d');
666
+ var imgData = canvasCtx.getImageData(0, 0, width, height);
667
+ var j = 0;
668
+ var sVal = 0;
669
+ var outData = '';
670
+ var outIdx = 0;
671
+ var data = imgData.data;
672
+ for (var y = 0; y < height; y++)
673
+ for (var x = 0; x < width; x++) {
674
+ var tmp1 = data[j];
675
+ var tmp2 = data[j + 1];
676
+ var tmp3 = data[j + 2];
677
+ var tmp4 = data[j + 3];
678
+ // sVal = tmp1 + (tmp2 << 8 ) + ( tmp3 << 16 ) + (tmp4 << 24 );
679
+ j = j + 4;
680
+ if (tmp1 < this.SigWebFontThreshold) {
681
+ outData += 'B';
682
+ }
683
+ else {
684
+ outData += 'W';
685
+ }
686
+ }
687
+ return outData;
688
+ };
689
+ SigWebTablet.toHex = function (NibVal) {
690
+ switch (NibVal) {
691
+ case 0:
692
+ return '0';
693
+ case 1:
694
+ return '1';
695
+ case 2:
696
+ return '2';
697
+ case 3:
698
+ return '3';
699
+ case 4:
700
+ return '4';
701
+ case 5:
702
+ return '5';
703
+ case 6:
704
+ return '6';
705
+ case 7:
706
+ return '7';
707
+ case 8:
708
+ return '8';
709
+ case 9:
710
+ return '9';
711
+ case 10:
712
+ return 'A';
713
+ case 11:
714
+ return 'B';
715
+ case 12:
716
+ return 'C';
717
+ case 13:
718
+ return 'D';
719
+ case 14:
720
+ return 'E';
721
+ case 15:
722
+ return 'F';
723
+ default:
724
+ return '';
725
+ }
726
+ };
727
+ SigWebTablet.ToHexString = function (ByteVal) {
728
+ var Str = '';
729
+ Str += this.toHex((ByteVal >> 4) & 0x0f);
730
+ Str += this.toHex(ByteVal & 0x0f);
731
+ return Str;
732
+ };
733
+ SigWebTablet.textToTablet = function (x, y, height, str, fnt) {
734
+ var c = document.createElement('canvas');
735
+ var cntx = c.getContext('2d');
736
+ cntx.font = fnt;
737
+ var txt = str;
738
+ var xs = Math.round(cntx.measureText(txt).width);
739
+ var ys = height;
740
+ c.width = xs;
741
+ c.height = ys;
742
+ cntx.font = fnt;
743
+ cntx.fillStyle = '#FFFFFF';
744
+ cntx.rect(0, 0, xs, ys);
745
+ cntx.fill();
746
+ cntx.fillStyle = '#000000';
747
+ cntx.textBaseline = 'top';
748
+ cntx.fillText(txt, 0, 0);
749
+ cntx.drawImage(cntx.canvas, 0, 0, xs, ys);
750
+ var Gstr = this.createLcdBitmapFromCanvas(c, 0, 0, xs, ys);
751
+ this.LcdWriteImageStream(0, 2, x, y, xs, ys, Gstr);
752
+ };
753
+ SigWebTablet.LcdWriteImage = function (Dst, Mode, Xp, Yp, Url) {
754
+ var Prop = 'LcdWriteImage/';
755
+ var NewUrl = Url.replace(/\//g, '_');
756
+ Prop = Prop + Dst + ',' + Mode + ',' + Xp + ',' + Yp + ',' + NewUrl;
757
+ this.SigWebSetPropertySync(Prop);
758
+ };
759
+ SigWebTablet.LcdWriteLocalImage = function (Dst, Mode, Xp, Yp, Url) {
760
+ var Prop = 'LcdWriteImage/';
761
+ Prop = Prop + Dst + ',' + Mode + ',' + Xp + ',' + Yp + ',' + Url;
762
+ this.SigWebSetProperty(Prop);
763
+ };
764
+ SigWebTablet.LcdWriteImageStream = function (Dst, Mode, Xp, Yp, Xs, Ys, Url) {
765
+ var Prop1 = 'LcdWriteImageStreamParams/' +
766
+ Dst +
767
+ ',' +
768
+ Mode +
769
+ ',' +
770
+ Xp +
771
+ ',' +
772
+ Yp +
773
+ ',' +
774
+ Xs +
775
+ ',' +
776
+ Ys;
777
+ var Prop2 = 'LcdWriteImageStream/';
778
+ this.SigWebSetPropertySync(Prop1);
779
+ this.SigWebSetImageStreamProperty(Prop2, Url);
780
+ };
781
+ SigWebTablet.LcdWriteImageBlob = function (Dst, Mode, Xp, Yp, Xs, Ys, Url) {
782
+ var Prop = 'LcdWriteImageStream/';
783
+ Prop = Prop + Dst + ',' + Mode + ',' + Xp + ',' + Yp + ',' + Xs + ',' + Ys;
784
+ this.SigWebSetImageBlobProperty(Prop, Url);
785
+ };
786
+ SigWebTablet.measureText = function (pText, pFontSize, pStyle) {
787
+ var lDiv = document.createElement('lDiv');
788
+ document.body.appendChild(lDiv);
789
+ if (pStyle != null) {
790
+ lDiv.setAttribute('style', pStyle);
791
+ }
792
+ lDiv.style.fontSize = '' + pFontSize + 'px';
793
+ lDiv.style.position = 'absolute';
794
+ lDiv.style.left = '-1000';
795
+ lDiv.style.top = '-1000';
796
+ lDiv.innerHTML = pText;
797
+ var lResult = {
798
+ width: lDiv.clientWidth,
799
+ height: lDiv.clientHeight,
800
+ };
801
+ document.body.removeChild(lDiv);
802
+ lDiv = null;
803
+ return lResult;
804
+ };
805
+ SigWebTablet.GetVersionString = function () {
806
+ var Prop = 'Version';
807
+ Prop = Prop;
808
+ var Str = this.SigWebGetVersion(Prop);
809
+ if (Str == null)
810
+ return Str;
811
+ var trimStr = Str.slice(1, Str.length - 2);
812
+ return trimStr;
813
+ };
814
+ SigWebTablet.IsPenDown = function () {
815
+ return this.EvStatus & 0x01;
816
+ };
817
+ //
818
+ // SigPlusNETSig.cs
819
+ //
820
+ SigWebTablet.ClearTablet = function () {
821
+ var Prop = 'ClearSignature';
822
+ Prop = Prop;
823
+ return this.SigWebGetProperty(Prop);
824
+ };
825
+ SigWebTablet.NumberOfTabletPoints = function () {
826
+ var Prop = 'TotalPoints';
827
+ Prop = Prop;
828
+ return this.SigWebGetProperty(Prop);
829
+ };
830
+ SigWebTablet.SetSigString = function (sigStr, ctx) {
831
+ var _this = this;
832
+ var Prop = 'SigString';
833
+ Prop = Prop;
834
+ var xhr = this.SigWebcreateXHR();
835
+ if (xhr) {
836
+ xhr.open('POST', this.baseUri + Prop);
837
+ xhr.setRequestHeader('Content-Type', 'text/plain');
838
+ xhr.send(sigStr);
839
+ xhr.onload = function () {
840
+ if (ctx) {
841
+ var can = ctx.canvas;
842
+ _this.SetImageXSize(can.width);
843
+ _this.SetImageYSize(can.height);
844
+ _this.GetSigImage(ctx);
845
+ }
846
+ };
847
+ }
848
+ return '';
849
+ };
850
+ SigWebTablet.GetSigString = function () {
851
+ var Prop = 'SigString';
852
+ Prop = Prop;
853
+ var Str = this.SigWebGetProperty(Prop);
854
+ return Str.slice(1, Str.length - 1);
855
+ };
856
+ SigWebTablet.SetSigCompressionMode = function (v) {
857
+ var Prop = 'CompressionMode/';
858
+ Prop = Prop + v;
859
+ this.SigWebSetPropertySync(Prop);
860
+ };
861
+ SigWebTablet.GetSigCompressionMode = function () {
862
+ var Prop = 'CompressionMode';
863
+ Prop = Prop;
864
+ return this.SigWebGetProperty(Prop);
865
+ };
866
+ SigWebTablet.SetEncryptionMode = function (v) {
867
+ var Prop = 'EncryptionMode/';
868
+ Prop = Prop + v;
869
+ this.SigWebSetPropertySync(Prop);
870
+ };
871
+ SigWebTablet.GetEncryptionMode = function () {
872
+ var Prop = 'EncryptionMode';
873
+ Prop = Prop;
874
+ return this.SigWebGetProperty(Prop);
875
+ };
876
+ SigWebTablet.SetKeyString = function (keyString) {
877
+ var Prop = 'KeyString';
878
+ Prop = Prop;
879
+ this.SigWebSetStreamProperty(Prop, keyString);
880
+ };
881
+ SigWebTablet.GetKeyString = function () {
882
+ var Prop = 'KeyString';
883
+ Prop = Prop;
884
+ var Str = this.SigWebGetProperty(Prop);
885
+ return Str.slice(1, Str.length - 1);
886
+ };
887
+ SigWebTablet.AutoKeyStart = function () {
888
+ var Prop = 'AutoKeyStart';
889
+ Prop = Prop;
890
+ this.SigWebSetPropertySync(Prop);
891
+ };
892
+ SigWebTablet.AutoKeyFinish = function () {
893
+ var Prop = 'AutoKeyFinish';
894
+ Prop = Prop;
895
+ this.SigWebSetPropertySync(Prop);
896
+ };
897
+ SigWebTablet.SetAutoKeyData = function (keyData) {
898
+ var Prop = 'SetAutoKeyData';
899
+ Prop = Prop;
900
+ this.SigWebSetStreamProperty(Prop, keyData);
901
+ };
902
+ SigWebTablet.AutoKeyAddData = function (keyData) {
903
+ var Prop = 'AutoKeyAddData';
904
+ Prop = Prop;
905
+ this.SigWebSetStreamProperty(Prop, keyData);
906
+ return this.GetKeyString();
907
+ };
908
+ // function GetKeyReceipt( ) {}
909
+ SigWebTablet.GetKeyReceiptAscii = function () {
910
+ var Prop = 'KeyReceiptAscii';
911
+ Prop = Prop;
912
+ var Str = this.SigWebGetProperty(Prop);
913
+ return Str.slice(1, Str.length - 1);
914
+ };
915
+ // function GetSigReceipt( ) {}
916
+ SigWebTablet.GetSigReceiptAscii = function () {
917
+ var Prop = 'SigReceiptAscii';
918
+ Prop = Prop;
919
+ var Str = this.SigWebGetProperty(Prop);
920
+ return Str.slice(1, Str.length - 1);
921
+ };
922
+ SigWebTablet.SetTimeStamp = function (timeStamp) {
923
+ var Prop = 'TimeStamp';
924
+ Prop = Prop;
925
+ this.SigWebSetStreamProperty(Prop, timeStamp);
926
+ };
927
+ SigWebTablet.GetTimeStamp = function () {
928
+ var Prop = 'TimeStamp';
929
+ Prop = Prop;
930
+ var Str = this.SigWebGetProperty(Prop);
931
+ return Str.slice(1, Str.length - 1);
932
+ };
933
+ SigWebTablet.SetAnnotate = function (annotate) {
934
+ var Prop = 'Annotate';
935
+ Prop = Prop;
936
+ this.SigWebSetStreamProperty(Prop, annotate);
937
+ };
938
+ SigWebTablet.GetAnnotate = function () {
939
+ var Prop = 'Annotate';
940
+ Prop = Prop;
941
+ var Str = this.SigWebGetProperty(Prop);
942
+ return Str.slice(1, Str.length - 1);
943
+ };
944
+ SigWebTablet.SetSaveSigInfo = function (v) {
945
+ var Prop = 'SaveSigInfo/';
946
+ Prop = Prop + v;
947
+ this.SigWebSetPropertySync(Prop);
948
+ };
949
+ SigWebTablet.GetSaveSigInfo = function () {
950
+ var Prop = 'SaveSigInfo';
951
+ Prop = Prop;
952
+ return this.SigWebGetProperty(Prop);
953
+ };
954
+ SigWebTablet.SetSavePressureData = function (v) {
955
+ var Prop = 'SavePressureData/';
956
+ Prop = Prop + v;
957
+ this.SigWebSetPropertySync(Prop);
958
+ };
959
+ SigWebTablet.GetSavePressureData = function () {
960
+ var Prop = 'SavePressureData';
961
+ Prop = Prop;
962
+ return this.SigWebGetProperty(Prop);
963
+ };
964
+ SigWebTablet.SetSaveTimeData = function (v) {
965
+ var Prop = 'SaveTimeData/';
966
+ Prop = Prop + v;
967
+ this.SigWebSetPropertySync(Prop);
968
+ };
969
+ SigWebTablet.GetSaveTimeData = function () {
970
+ var Prop = 'SaveTimeData';
971
+ Prop = Prop;
972
+ return this.SigWebGetProperty(Prop);
973
+ };
974
+ SigWebTablet.SetAntiAliasSpotSize = function (v) {
975
+ var Prop = 'AntiAliasSpotSize/';
976
+ Prop = Prop + v;
977
+ this.SigWebSetPropertySync(Prop);
978
+ };
979
+ SigWebTablet.GetAntiAliasSpotSize = function () {
980
+ var Prop = 'AntiAliasSpotSize';
981
+ Prop = Prop;
982
+ return this.SigWebGetProperty(Prop);
983
+ };
984
+ SigWebTablet.SetAntiAliasLineScale = function (v) {
985
+ var Prop = 'AntiAliasLineScale/';
986
+ Prop = Prop + v;
987
+ this.SigWebSetPropertySync(Prop);
988
+ };
989
+ SigWebTablet.GetAntiAliasLineScale = function () {
990
+ var Prop = 'AntiAliasLineScale';
991
+ Prop = Prop;
992
+ return this.SigWebGetProperty(Prop);
993
+ };
994
+ SigWebTablet.GetNumberOfStrokes = function () {
995
+ var Prop = 'NumberOfStrokes';
996
+ Prop = Prop;
997
+ return this.SigWebGetProperty(Prop);
998
+ };
999
+ SigWebTablet.GetNumPointsForStroke = function (v) {
1000
+ var Prop = 'NumberOfPointsInStroke/';
1001
+ Prop = Prop + v;
1002
+ return this.SigWebGetProperty(Prop);
1003
+ };
1004
+ SigWebTablet.GetPointXValue = function (v1, v2) {
1005
+ var Prop = 'PointXValue/';
1006
+ Prop = Prop + v1 + '/' + v2;
1007
+ return this.SigWebGetProperty(Prop);
1008
+ };
1009
+ SigWebTablet.GetPointYValue = function (v1, v2) {
1010
+ var Prop = 'PointYValue/';
1011
+ Prop = Prop + v1 + '/' + v2;
1012
+ return this.SigWebGetProperty(Prop);
1013
+ };
1014
+ SigWebTablet.SetAntiAliasEnable = function (v) {
1015
+ var Prop = 'AntiAliasEnable/';
1016
+ Prop = Prop + v;
1017
+ this.SigWebSetPropertySync(Prop);
1018
+ };
1019
+ SigWebTablet.GetAntiAliasEnable = function () {
1020
+ var Prop = 'AntiAliasEnable';
1021
+ Prop = Prop;
1022
+ return this.SigWebGetProperty(Prop);
1023
+ };
1024
+ SigWebTablet.SetUseAmbientColors = function (v) {
1025
+ var Prop = 'UseAmbientColors/';
1026
+ Prop = Prop + v;
1027
+ this.SigWebSetPropertySync(Prop);
1028
+ };
1029
+ //
1030
+ // SigPlusNETDisplay.cs
1031
+ //
1032
+ SigWebTablet.SetDisplayXSize = function (v) {
1033
+ var Prop = 'DisplayXSize/';
1034
+ Prop = Prop + v;
1035
+ this.SigWebSetPropertySync(Prop);
1036
+ };
1037
+ SigWebTablet.GetDisplayXSize = function () {
1038
+ var Prop = 'DisplayXSize';
1039
+ Prop = Prop;
1040
+ return this.SigWebGetProperty(Prop);
1041
+ };
1042
+ SigWebTablet.SetDisplayYSize = function (v) {
1043
+ var Prop = 'DisplayYSize/';
1044
+ Prop = Prop + v;
1045
+ this.SigWebSetPropertySync(Prop);
1046
+ };
1047
+ SigWebTablet.GetDisplayYSize = function () {
1048
+ var Prop = 'DisplayYSize';
1049
+ Prop = Prop;
1050
+ return this.SigWebGetProperty(Prop);
1051
+ };
1052
+ SigWebTablet.SetDisplayPenWidth = function (v) {
1053
+ var Prop = 'DisplayPenWidth/';
1054
+ Prop = Prop + v;
1055
+ this.SigWebSetPropertySync(Prop);
1056
+ };
1057
+ SigWebTablet.GetDisplayPenWidth = function () {
1058
+ var Prop = 'DisplayPenWidth';
1059
+ Prop = Prop;
1060
+ return this.SigWebGetProperty(Prop);
1061
+ };
1062
+ SigWebTablet.SetDisplayTimeStamp = function (v) {
1063
+ var Prop = 'DisplayTimeStamp/';
1064
+ Prop = Prop + v;
1065
+ this.SigWebSetPropertySync(Prop);
1066
+ };
1067
+ SigWebTablet.GetDisplayTimeStamp = function () {
1068
+ var Prop = 'DisplayTimeStamp';
1069
+ Prop = Prop;
1070
+ return this.SigWebGetProperty(Prop);
1071
+ };
1072
+ SigWebTablet.SetDisplayTimeStampPosX = function (v) {
1073
+ var Prop = 'DisplayTimeStampPosX/';
1074
+ Prop = Prop + v;
1075
+ this.SigWebSetPropertySync(Prop);
1076
+ };
1077
+ SigWebTablet.GetDisplayTimeStampPosX = function () {
1078
+ var Prop = 'DisplayTimeStampPosX';
1079
+ Prop = Prop;
1080
+ return this.SigWebGetProperty(Prop);
1081
+ };
1082
+ SigWebTablet.SetDisplayTimeStampPosY = function (v) {
1083
+ var Prop = 'DisplayTimeStampPosY/';
1084
+ Prop = Prop + v;
1085
+ this.SigWebSetPropertySync(Prop);
1086
+ };
1087
+ SigWebTablet.GetDisplayTimeStampPosY = function () {
1088
+ var Prop = 'DisplayTimeStampPosY';
1089
+ Prop = Prop;
1090
+ return this.SigWebGetProperty(Prop);
1091
+ };
1092
+ SigWebTablet.SetDisplayTimeStampSize = function (v) {
1093
+ var Prop = 'DisplayTimeStampSize/';
1094
+ Prop = Prop + v;
1095
+ this.SigWebSetPropertySync(Prop);
1096
+ };
1097
+ SigWebTablet.GetDisplayTimeStampSize = function () {
1098
+ var Prop = 'DisplayTimeStampSize';
1099
+ Prop = Prop;
1100
+ return this.SigWebGetProperty(Prop);
1101
+ };
1102
+ SigWebTablet.SetDisplayAnnotate = function (v) {
1103
+ var Prop = 'DisplayAnnotate/';
1104
+ Prop = Prop + v;
1105
+ this.SigWebSetPropertySync(Prop);
1106
+ };
1107
+ SigWebTablet.GetDisplayAnnotate = function () {
1108
+ var Prop = 'DisplayAnnotate';
1109
+ Prop = Prop;
1110
+ return this.SigWebGetProperty(Prop);
1111
+ };
1112
+ SigWebTablet.SetDisplayAnnotatePosX = function (v) {
1113
+ var Prop = 'DisplayAnnotatePosX/';
1114
+ Prop = Prop + v;
1115
+ this.SigWebSetPropertySync(Prop);
1116
+ };
1117
+ SigWebTablet.GetDisplayAnnotatePosX = function () {
1118
+ var Prop = 'DisplayAnnotatePosX';
1119
+ Prop = Prop;
1120
+ return this.SigWebGetProperty(Prop);
1121
+ };
1122
+ SigWebTablet.SetDisplayAnnotatePosY = function (v) {
1123
+ var Prop = 'DisplayAnnotatePosY/';
1124
+ Prop = Prop + v;
1125
+ this.SigWebSetPropertySync(Prop);
1126
+ };
1127
+ SigWebTablet.GetDisplayAnnotatePosY = function () {
1128
+ var Prop = 'DisplayAnnotatePosY';
1129
+ Prop = Prop;
1130
+ return this.SigWebGetProperty(Prop);
1131
+ };
1132
+ SigWebTablet.SetDisplayAnnotateSize = function (v) {
1133
+ var Prop = 'DisplayAnnotateSize/';
1134
+ Prop = Prop + v;
1135
+ this.SigWebSetPropertySync(Prop);
1136
+ };
1137
+ SigWebTablet.GetDisplayAnnotateSize = function () {
1138
+ var Prop = 'DisplayAnnotateSize';
1139
+ Prop = Prop;
1140
+ return this.SigWebGetProperty(Prop);
1141
+ };
1142
+ //
1143
+ // SigPlusNETImage.cs
1144
+ //
1145
+ // function GetSigImageB64( )
1146
+ // {
1147
+ // var xhr2 = new XMLHttpRequest();
1148
+ // xhr2.open("GET", baseUri + "SigImage/1", false );
1149
+ // xhr2.responseType = "blob"
1150
+ // xhr2.send(null);
1151
+ // if (xhr2.readyState == 4 && xhr.status == 200)
1152
+ // {
1153
+ // return window.URL.createObjectURL(xhr2.response);
1154
+ // }
1155
+ // return null;
1156
+ // }
1157
+ SigWebTablet.SetImageXSize = function (v) {
1158
+ var Prop = 'ImageXSize/';
1159
+ Prop = Prop + v;
1160
+ this.SigWebSetPropertySync(Prop);
1161
+ };
1162
+ SigWebTablet.GetImageXSize = function () {
1163
+ var Prop = 'ImageXSize';
1164
+ Prop = Prop;
1165
+ return this.SigWebGetProperty(Prop);
1166
+ };
1167
+ SigWebTablet.SetImageYSize = function (v) {
1168
+ var Prop = 'ImageYSize/';
1169
+ Prop = Prop + v;
1170
+ this.SigWebSetPropertySync(Prop);
1171
+ };
1172
+ SigWebTablet.GetImageYSize = function () {
1173
+ var Prop = 'ImageYSize';
1174
+ Prop = Prop;
1175
+ return this.SigWebGetProperty(Prop);
1176
+ };
1177
+ SigWebTablet.SetImagePenWidth = function (v) {
1178
+ var Prop = 'ImagePenWidth/';
1179
+ Prop = Prop + v;
1180
+ this.SigWebSetPropertySync(Prop);
1181
+ };
1182
+ SigWebTablet.GetImagePenWidth = function () {
1183
+ var Prop = 'ImagePenWidth';
1184
+ Prop = Prop;
1185
+ return this.SigWebGetProperty(Prop);
1186
+ };
1187
+ SigWebTablet.SetImageTimeStamp = function (v) {
1188
+ var Prop = 'ImageTimeStamp/';
1189
+ Prop = Prop + v;
1190
+ this.SigWebSetPropertySync(Prop);
1191
+ };
1192
+ SigWebTablet.GetImageTimeStamp = function () {
1193
+ var Prop = 'ImageTimeStamp';
1194
+ Prop = Prop;
1195
+ return this.SigWebGetProperty(Prop);
1196
+ };
1197
+ SigWebTablet.SetImageTimeStampPosX = function (v) {
1198
+ var Prop = 'ImageTimeStampPosX/';
1199
+ Prop = Prop + v;
1200
+ this.SigWebSetPropertySync(Prop);
1201
+ };
1202
+ SigWebTablet.GetImageTimeStampPosX = function () {
1203
+ var Prop = 'ImageTimeStampPosX';
1204
+ Prop = Prop;
1205
+ return this.SigWebGetProperty(Prop);
1206
+ };
1207
+ SigWebTablet.SetImageTimeStampPosY = function (v) {
1208
+ var Prop = 'ImageTimeStampPosY/';
1209
+ Prop = Prop + v;
1210
+ this.SigWebSetPropertySync(Prop);
1211
+ };
1212
+ SigWebTablet.GetImageTimeStampPosY = function () {
1213
+ var Prop = 'ImageTimeStampPosY';
1214
+ Prop = Prop;
1215
+ return this.SigWebGetProperty(Prop);
1216
+ };
1217
+ SigWebTablet.SetImageTimeStampSize = function (v) {
1218
+ var Prop = 'ImageTimeStampSize/';
1219
+ Prop = Prop + v;
1220
+ this.SigWebSetPropertySync(Prop);
1221
+ };
1222
+ SigWebTablet.GetImageTimeStampSize = function () {
1223
+ var Prop = 'ImageTimeStampSize';
1224
+ Prop = Prop;
1225
+ return this.SigWebGetProperty(Prop);
1226
+ };
1227
+ SigWebTablet.SetImageAnnotate = function (v) {
1228
+ var Prop = 'ImageAnnotate/';
1229
+ Prop = Prop + v;
1230
+ this.SigWebSetPropertySync(Prop);
1231
+ };
1232
+ SigWebTablet.GetImageAnnotate = function () {
1233
+ var Prop = 'ImageAnnotate';
1234
+ Prop = Prop;
1235
+ return this.SigWebGetProperty(Prop);
1236
+ };
1237
+ SigWebTablet.SetImageAnnotatePosX = function (v) {
1238
+ var Prop = 'ImageAnnotatePosX/';
1239
+ Prop = Prop + v;
1240
+ this.SigWebSetPropertySync(Prop);
1241
+ };
1242
+ SigWebTablet.GetImageAnnotatePosX = function () {
1243
+ var Prop = 'ImageAnnotatePosX';
1244
+ Prop = Prop;
1245
+ return this.SigWebGetProperty(Prop);
1246
+ };
1247
+ SigWebTablet.SetImageAnnotatePosY = function (v) {
1248
+ var Prop = 'ImageAnnotatePosY/';
1249
+ Prop = Prop + v;
1250
+ this.SigWebSetPropertySync(Prop);
1251
+ };
1252
+ SigWebTablet.GetImageAnnotatePosY = function () {
1253
+ var Prop = 'ImageAnnotatePosY';
1254
+ Prop = Prop;
1255
+ return this.SigWebGetProperty(Prop);
1256
+ };
1257
+ SigWebTablet.SetImageAnnotateSize = function (v) {
1258
+ var Prop = 'ImageAnnotateSize/';
1259
+ Prop = Prop + v;
1260
+ this.SigWebSetPropertySync(Prop);
1261
+ };
1262
+ SigWebTablet.GetImageAnnotateSize = function () {
1263
+ var Prop = 'ImageAnnotateSize';
1264
+ Prop = Prop;
1265
+ return this.SigWebGetProperty(Prop);
1266
+ };
1267
+ SigWebTablet.SetJustifyX = function (v) {
1268
+ var Prop = 'JustifyX/';
1269
+ Prop = Prop + v;
1270
+ this.SigWebSetPropertySync(Prop);
1271
+ };
1272
+ SigWebTablet.GetJustifyX = function () {
1273
+ var Prop = 'JustifyX';
1274
+ Prop = Prop;
1275
+ return this.SigWebGetProperty(Prop);
1276
+ };
1277
+ SigWebTablet.SetJustifyY = function (v) {
1278
+ var Prop = 'JustifyY/';
1279
+ Prop = Prop + v;
1280
+ this.SigWebSetPropertySync(Prop);
1281
+ };
1282
+ SigWebTablet.GetJustifyY = function () {
1283
+ var Prop = 'JustifyY';
1284
+ Prop = Prop;
1285
+ return this.SigWebGetProperty(Prop);
1286
+ };
1287
+ SigWebTablet.SetJustifyMode = function (v) {
1288
+ var Prop = 'JustifyMode/';
1289
+ Prop = Prop + v;
1290
+ this.SigWebSetPropertySync(Prop);
1291
+ };
1292
+ SigWebTablet.GetJustifyMode = function () {
1293
+ var Prop = 'JustifyMode';
1294
+ Prop = Prop;
1295
+ return this.SigWebGetProperty(Prop);
1296
+ };
1297
+ //
1298
+ // SigPlusNETKeyPad.cs
1299
+ //
1300
+ SigWebTablet.KeyPadAddHotSpot = function (key, coord, xp, yp, xs, ys) {
1301
+ var Prop = 'KeyPadAddHotSpot/';
1302
+ Prop = Prop + key + ',' + coord + ',' + xp + ',' + yp + ',' + xs + ',' + ys;
1303
+ this.SigWebSetPropertySync(Prop);
1304
+ };
1305
+ SigWebTablet.KeyPadMarkHotSpot = function (key, coord, xp, yp, xs, ys) {
1306
+ this.LCDWriteString(0, 2, xp, yp, '16pt sans-serif', 32, '+');
1307
+ this.LCDWriteString(0, 2, xp + xs, yp, '16pt sans-serif', 32, '+');
1308
+ this.LCDWriteString(0, 2, xp, yp + ys, '16pt sans-serif', 32, '+');
1309
+ this.LCDWriteString(0, 2, xp + xs, yp + ys, '16pt sans-serif', 32, '+');
1310
+ };
1311
+ SigWebTablet.KeyPadQueryHotSpot = function (key) {
1312
+ var Prop = 'KeyPadQueryHotSpot/';
1313
+ Prop = Prop + key;
1314
+ return this.SigWebGetProperty(Prop);
1315
+ };
1316
+ SigWebTablet.KeyPadClearHotSpotList = function () {
1317
+ var Prop = 'KeyPadClearHotSpotList';
1318
+ this.SigWebSetPropertySync(Prop);
1319
+ };
1320
+ SigWebTablet.SetSigWindow = function (coords, xp, yp, xs, ys) {
1321
+ var Prop = 'SigWindow/';
1322
+ Prop = Prop + coords + ',' + xp + ',' + yp + ',' + xs + ',' + ys;
1323
+ this.SigWebSetPropertySync(Prop);
1324
+ };
1325
+ SigWebTablet.ClearSigWindow = function (inside) {
1326
+ var Prop = 'ClearSigWindow/';
1327
+ Prop = Prop + inside;
1328
+ this.SigWebSetPropertySync(Prop);
1329
+ };
1330
+ //
1331
+ // SigPlusNETLCD.cs
1332
+ //
1333
+ SigWebTablet.SetLCDCaptureMode = function (v) {
1334
+ var Prop = 'CaptureMode/';
1335
+ Prop = Prop + v;
1336
+ this.SigWebSetPropertySync(Prop);
1337
+ };
1338
+ SigWebTablet.GetLCDCaptureMode = function () {
1339
+ var Prop = 'CaptureMode';
1340
+ Prop = Prop;
1341
+ return this.SigWebGetProperty(Prop);
1342
+ };
1343
+ SigWebTablet.LCDSetWindow = function (xP, yP, xS, yS) {
1344
+ var Prop = 'LCDSetWindow/';
1345
+ Prop = Prop + xP + ',' + yP + ',' + xS + ',' + yS;
1346
+ this.SigWebSetPropertySync(Prop);
1347
+ };
1348
+ SigWebTablet.LCDWriteString = function (dest, mode, x, y, fnt, size, str) {
1349
+ var c = document.createElement('canvas');
1350
+ var cntx = c.getContext('2d');
1351
+ cntx.font = fnt;
1352
+ var txt = str;
1353
+ var xs = Math.round(cntx.measureText(txt).width);
1354
+ var ys = size;
1355
+ c.width = xs;
1356
+ c.height = ys;
1357
+ if (xs == 0) {
1358
+ return;
1359
+ }
1360
+ cntx.font = fnt;
1361
+ cntx.fillStyle = '#FFFFFF';
1362
+ cntx.rect(0, 0, xs, ys);
1363
+ cntx.fill();
1364
+ cntx.fillStyle = '#000000';
1365
+ cntx.textBaseline = 'top';
1366
+ cntx.fillText(txt, 0, 0);
1367
+ cntx.drawImage(cntx.canvas, 0, 0, xs, ys);
1368
+ var Gstr = this.createLcdBitmapFromCanvas(c, x, y, xs, ys);
1369
+ this.LcdWriteImageStream(dest, mode, x, y, xs, ys, Gstr);
1370
+ };
1371
+ SigWebTablet.LCDDrawRectangle = function (dest, mode, x, y, xs, ys, fill) {
1372
+ var c = document.createElement('canvas');
1373
+ var cntx = c.getContext('2d');
1374
+ c.width = xs;
1375
+ c.height = ys;
1376
+ cntx.fillStyle = fill;
1377
+ cntx.rect(0, 0, xs, ys);
1378
+ cntx.fill();
1379
+ cntx.drawImage(cntx.canvas, 0, 0, xs, ys);
1380
+ var Gstr = this.createLcdBitmapFromCanvas(c, x, y, xs, ys);
1381
+ this.LcdWriteImageBlob(dest, mode, x, y, xs, ys, Gstr);
1382
+ };
1383
+ SigWebTablet.LCDDrawButton = function (dest, mode, x, y, xs, ys, strys, fill, fnt, str) {
1384
+ var c = document.createElement('canvas');
1385
+ var cntx = c.getContext('2d');
1386
+ cntx.font = fnt;
1387
+ var txt = str;
1388
+ var sxs = Math.round(cntx.measureText(txt).width);
1389
+ var sys = strys;
1390
+ c.width = xs;
1391
+ c.height = ys;
1392
+ cntx.font = fnt;
1393
+ cntx.fillStyle = fill;
1394
+ cntx.rect(0, 0, xs, ys);
1395
+ cntx.fill();
1396
+ cntx.fillStyle = '#FFFFFF';
1397
+ cntx.textBaseline = 'top';
1398
+ cntx.fillText(txt, (xs - sxs) / 2, (ys - sys) / 2);
1399
+ cntx.drawImage(cntx.canvas, 0, 0, xs, ys);
1400
+ var Gstr = this.createLcdBitmapFromCanvas(c, x, y, xs, ys);
1401
+ this.LcdWriteImageBlob(dest, mode, x, y, xs, ys, Gstr);
1402
+ };
1403
+ SigWebTablet.LCDWriteStringWindow = function (dest, mode, x, y, fnt, xsize, ysize, str) {
1404
+ var c = document.createElement('canvas');
1405
+ var cntx = c.getContext('2d');
1406
+ cntx.font = fnt;
1407
+ var txt = str;
1408
+ var xs = xsize;
1409
+ var ys = ysize;
1410
+ c.width = xs;
1411
+ c.height = ys;
1412
+ cntx.font = fnt;
1413
+ cntx.fillStyle = '#FFFFFF';
1414
+ cntx.rect(0, 0, xs, ys);
1415
+ cntx.fill();
1416
+ cntx.fillStyle = '#000000';
1417
+ cntx.textBaseline = 'top';
1418
+ cntx.fillText(txt, 0, 0);
1419
+ cntx.drawImage(cntx.canvas, 0, 0, xs, ys);
1420
+ var Gstr = this.createLcdBitmapFromCanvas(c, x, y, xs, ys);
1421
+ this.LcdWriteImageBlob(dest, mode, x, y, xs, ys, Gstr);
1422
+ };
1423
+ SigWebTablet.LCDStringWidth = function (fnt, str) {
1424
+ var c = document.createElement('canvas');
1425
+ var cntx = c.getContext('2d');
1426
+ cntx.font = fnt;
1427
+ var txt = str;
1428
+ var xs = Math.round(cntx.measureText(txt).width);
1429
+ return xs;
1430
+ };
1431
+ SigWebTablet.LCDStringHeight = function (fnt, str) {
1432
+ return 16;
1433
+ };
1434
+ SigWebTablet.LcdRefresh = function (Mode, Xp, Yp, Xs, Ys) {
1435
+ var Prop = 'LcdRefresh/';
1436
+ Prop = Prop + Mode + ',' + Xp + ',' + Yp + ',' + Xs + ',' + Ys;
1437
+ this.SigWebSetPropertySync(Prop);
1438
+ };
1439
+ SigWebTablet.LCDSendCmdString = function (CmdStr, ReturnCount, Result, TimeOut) {
1440
+ var Prop = 'LcdSendCmdString/';
1441
+ Prop = Prop + ReturnCount + ',' + TimeOut;
1442
+ Result = this.SigWebSetStreamProperty(Prop, CmdStr);
1443
+ };
1444
+ SigWebTablet.LCDSendCmdData = function (CmdStr, ReturnCount, Result, TimeOut) {
1445
+ var Prop = 'LcdSendCmdData/';
1446
+ Prop = Prop + ReturnCount + ',' + TimeOut;
1447
+ Result = this.SigWebSetStreamProperty(Prop, CmdStr);
1448
+ };
1449
+ // function LCDSendWindowedGraphicCanvas( dest, mode, x, y, canvas )
1450
+ // {
1451
+ // }
1452
+ // function LCDSendWindowedGraphicCanvas( dest, mode, x, y, xs, ys, canvas )
1453
+ // {
1454
+ // var Gstr = this.createLcdBitmapFromCanvas( canvas, 0, 0, xs, ys)
1455
+ // LcdWriteImageStream( dest, mode, x, y, xs, ys, Gstr );
1456
+ // }
1457
+ SigWebTablet.LCDSendWindowedGraphicCanvas = function (dest, mode, x, y, xs, ys, c, xps, yps) {
1458
+ var canvas = document.createElement('canvas');
1459
+ var Gstr = this.createLcdBitmapFromCanvas(canvas, xps, yps, xs, ys);
1460
+ this.LcdWriteImageStream(dest, mode, x, y, xs, ys, Gstr);
1461
+ };
1462
+ SigWebTablet.LCDSendGraphicUrl = function (dest, mode, x, y, url) {
1463
+ this.LcdWriteImage(dest, mode, x, y, url);
1464
+ };
1465
+ // function LCDSendGraphic( Dest, Mode, XPos, YPos, ImageFileName ) {}
1466
+ // function LCDSendGraphicURL( Dest, Mode, XPos, YPos, URL ) {}
1467
+ SigWebTablet.LCDClear = function () {
1468
+ var Prop = 'LcdClear';
1469
+ Prop = Prop;
1470
+ return this.SigWebGetProperty(Prop);
1471
+ };
1472
+ SigWebTablet.LCDSetTabletMap = function (LCDType, LCDXSize, LCDYSize, LCDXStart, LCDYStart, LCDXStop, LCDYStop) { };
1473
+ SigWebTablet.LCDSetPixelDepth = function (v) {
1474
+ var Prop = 'LcdSetPixelDepth/';
1475
+ Prop = Prop + v;
1476
+ this.SigWebSetPropertySync(Prop);
1477
+ };
1478
+ SigWebTablet.LCDGetLCDSize = function () {
1479
+ var Prop = 'LcdGetLcdSize';
1480
+ Prop = Prop;
1481
+ return this.SigWebGetProperty(Prop);
1482
+ };
1483
+ SigWebTablet.LCDGetCompressionMode = function () {
1484
+ var Prop = 'LcdCompressionMode';
1485
+ Prop = Prop;
1486
+ return this.SigWebGetProperty(Prop);
1487
+ };
1488
+ SigWebTablet.LCDGetZCompressionMode = function () {
1489
+ var Prop = 'LcdZCompressionMode';
1490
+ Prop = Prop;
1491
+ return this.SigWebGetProperty(Prop);
1492
+ };
1493
+ //
1494
+ // SigPlusNETLCD.cs
1495
+ //
1496
+ SigWebTablet.SetRealTabletState = function (v) {
1497
+ var Prop = 'TabletState/';
1498
+ Prop = Prop + v;
1499
+ this.SigWebSetPropertySync(Prop);
1500
+ };
1501
+ SigWebTablet.GetTabletState = function () {
1502
+ var Prop = 'TabletState';
1503
+ Prop = Prop;
1504
+ return this.SigWebGetProperty(Prop);
1505
+ };
1506
+ SigWebTablet.SetTabletLogicalXSize = function (v) {
1507
+ var Prop = 'TabletLogicalXSize/';
1508
+ Prop = Prop + v;
1509
+ this.SigWebSetPropertySync(Prop);
1510
+ };
1511
+ SigWebTablet.GetTabletLogicalXSize = function () {
1512
+ var Prop = 'TabletLogicalXSize';
1513
+ Prop = Prop;
1514
+ return this.SigWebGetProperty(Prop);
1515
+ };
1516
+ SigWebTablet.GetTabletLogicalYSize = function () {
1517
+ var Prop = 'TabletLogicalYSize';
1518
+ Prop = Prop;
1519
+ return this.SigWebGetProperty(Prop);
1520
+ };
1521
+ SigWebTablet.SetTabletLogicalYSize = function (v) {
1522
+ var Prop = 'TabletLogicalYSize/';
1523
+ Prop = Prop + v;
1524
+ this.SigWebSetPropertySync(Prop);
1525
+ };
1526
+ SigWebTablet.SetTabletXStart = function (v) {
1527
+ var Prop = 'TabletXStart/';
1528
+ Prop = Prop + v;
1529
+ this.SigWebSetPropertySync(Prop);
1530
+ };
1531
+ SigWebTablet.GetTabletXStart = function () {
1532
+ var Prop = 'TabletXStart';
1533
+ Prop = Prop;
1534
+ return this.SigWebGetProperty(Prop);
1535
+ };
1536
+ SigWebTablet.SetTabletYStart = function (v) {
1537
+ var Prop = 'TabletYStart/';
1538
+ Prop = Prop + v;
1539
+ this.SigWebSetPropertySync(Prop);
1540
+ };
1541
+ SigWebTablet.GetTabletYStart = function () {
1542
+ var Prop = 'TabletYStart';
1543
+ Prop = Prop;
1544
+ return this.SigWebGetProperty(Prop);
1545
+ };
1546
+ SigWebTablet.SetTabletXStop = function (v) {
1547
+ var Prop = 'TabletXStop/';
1548
+ Prop = Prop + v;
1549
+ this.SigWebSetPropertySync(Prop);
1550
+ };
1551
+ SigWebTablet.GetTabletXStop = function () {
1552
+ var Prop = 'TabletXStop';
1553
+ Prop = Prop;
1554
+ return this.SigWebGetProperty(Prop);
1555
+ };
1556
+ SigWebTablet.SetTabletYStop = function (v) {
1557
+ var Prop = 'TabletYStop/';
1558
+ Prop = Prop + v;
1559
+ this.SigWebSetPropertySync(Prop);
1560
+ };
1561
+ SigWebTablet.GetTabletYStop = function () {
1562
+ var Prop = 'TabletYStop';
1563
+ Prop = Prop;
1564
+ return this.SigWebGetProperty(Prop);
1565
+ };
1566
+ SigWebTablet.SetTabletFilterPoints = function (v) {
1567
+ var Prop = 'TabletFilterPoints/';
1568
+ Prop = Prop + v;
1569
+ this.SigWebSetPropertySync(Prop);
1570
+ };
1571
+ SigWebTablet.GetTabletFilterPoints = function () {
1572
+ var Prop = 'TabletFilterPoints';
1573
+ Prop = Prop;
1574
+ return this.SigWebGetProperty(Prop);
1575
+ };
1576
+ SigWebTablet.SetTabletTimingAdvance = function (v) {
1577
+ var Prop = 'TabletTimingAdvance/';
1578
+ Prop = Prop + v;
1579
+ this.SigWebSetPropertySync(Prop);
1580
+ };
1581
+ SigWebTablet.GetTabletTimingAdvance = function () {
1582
+ var Prop = 'TabletTimingAdvance';
1583
+ Prop = Prop;
1584
+ return this.SigWebGetProperty(Prop);
1585
+ };
1586
+ SigWebTablet.SetTabletComPort = function (v) {
1587
+ var Prop = 'TabletComPort/';
1588
+ Prop = Prop + v;
1589
+ this.SigWebSetPropertySync(Prop);
1590
+ };
1591
+ SigWebTablet.GetTabletComPort = function () {
1592
+ var Prop = 'TabletComPort';
1593
+ Prop = Prop;
1594
+ return this.SigWebGetProperty(Prop);
1595
+ };
1596
+ SigWebTablet.SetTabletBaudRate = function (v) {
1597
+ var Prop = 'TabletBaudRate/';
1598
+ Prop = Prop + v;
1599
+ this.SigWebSetPropertySync(Prop);
1600
+ };
1601
+ SigWebTablet.GetTabletBaudRate = function () {
1602
+ var Prop = 'TabletBaudRate';
1603
+ Prop = Prop;
1604
+ return this.SigWebGetProperty(Prop);
1605
+ };
1606
+ SigWebTablet.SetTabletRotation = function (v) {
1607
+ var Prop = 'TabletRotation/';
1608
+ Prop = Prop + v;
1609
+ this.SigWebSetPropertySync(Prop);
1610
+ };
1611
+ SigWebTablet.GetTabletRotation = function () {
1612
+ var Prop = 'TabletRotation';
1613
+ Prop = Prop;
1614
+ return this.SigWebGetProperty(Prop);
1615
+ };
1616
+ SigWebTablet.SetTabletType = function (v) {
1617
+ var Prop = 'TabletType/';
1618
+ Prop = Prop + v;
1619
+ this.SigWebSetPropertySync(Prop);
1620
+ };
1621
+ SigWebTablet.GetTabletType = function () {
1622
+ var Prop = 'TabletType';
1623
+ Prop = Prop;
1624
+ return this.SigWebGetProperty(Prop);
1625
+ };
1626
+ SigWebTablet.SetServerTabletType = function (v) {
1627
+ var Prop = 'ServerTabletType/';
1628
+ Prop = Prop + v;
1629
+ this.SigWebSetPropertySync(Prop);
1630
+ };
1631
+ SigWebTablet.GetServerTabletType = function () {
1632
+ var Prop = 'ServerTabletType';
1633
+ Prop = Prop;
1634
+ return this.SigWebGetProperty(Prop);
1635
+ };
1636
+ SigWebTablet.SetTabletComTest = function (v) {
1637
+ var Prop = 'TabletComTest/';
1638
+ Prop = Prop + v;
1639
+ this.SigWebSetPropertySync(Prop);
1640
+ };
1641
+ SigWebTablet.GetTabletComTest = function () {
1642
+ var Prop = 'TabletComTest';
1643
+ Prop = Prop;
1644
+ return this.SigWebGetProperty(Prop);
1645
+ };
1646
+ SigWebTablet.SetTabletResolution = function (v) {
1647
+ var Prop = 'TabletResolution/';
1648
+ Prop = Prop + v;
1649
+ this.SigWebSetPropertySync(Prop);
1650
+ };
1651
+ SigWebTablet.GetTabletResolution = function () {
1652
+ var Prop = 'TabletResolution';
1653
+ Prop = Prop;
1654
+ return this.SigWebGetProperty(Prop);
1655
+ };
1656
+ SigWebTablet.TabletConnectQuery = function () {
1657
+ var Prop = 'TabletConnectQuery';
1658
+ Prop = Prop;
1659
+ return this.SigWebGetProperty(Prop);
1660
+ };
1661
+ SigWebTablet.TabletModelNumber = function () {
1662
+ var Prop = 'TabletModelNumber';
1663
+ Prop = Prop;
1664
+ return this.SigWebGetProperty(Prop);
1665
+ };
1666
+ SigWebTablet.TabletSerialNumber = function () {
1667
+ var Prop = 'TabletSerialNumber';
1668
+ Prop = Prop;
1669
+ return this.SigWebGetProperty(Prop);
1670
+ };
1671
+ SigWebTablet.SetTabletPortPath = function (v) {
1672
+ var Prop = 'TabletPortPath/';
1673
+ Prop = Prop + v;
1674
+ this.SigWebSetPropertySync(Prop);
1675
+ };
1676
+ SigWebTablet.SetTabletLocalIniFilePath = function (v) {
1677
+ var Prop = 'TabletLocalIniFilePath/';
1678
+ Prop = Prop + v;
1679
+ this.SigWebSetPropertySync(Prop);
1680
+ };
1681
+ SigWebTablet.SetTabletModel = function (v) {
1682
+ var Prop = 'TabletModel/';
1683
+ Prop = Prop + v;
1684
+ this.SigWebSetPropertySync(Prop);
1685
+ };
1686
+ SigWebTablet.SetSerialPortCloseDelay = function (v) {
1687
+ var Prop = 'SerialPortCloseDelay/';
1688
+ Prop = Prop + v;
1689
+ this.SigWebSetPropertySync(Prop);
1690
+ };
1691
+ SigWebTablet.GetSerialPortCloseDelay = function () {
1692
+ var Prop = 'SerialPortCloseDelay';
1693
+ Prop = Prop;
1694
+ return this.SigWebGetProperty(Prop);
1695
+ };
1696
+ SigWebTablet.EnableTabletEncryption = function () {
1697
+ var Prop = 'EnableTabletEncryption';
1698
+ Prop = Prop;
1699
+ this.SigWebSetPropertySync(Prop);
1700
+ };
1701
+ SigWebTablet.SetTabletEncryptionMode = function (hmode, tmode) {
1702
+ var Prop = 'TabletEncryptionMode/';
1703
+ Prop = Prop + hmode + ',' + tmode;
1704
+ this.SigWebSetPropertySync(Prop);
1705
+ };
1706
+ SigWebTablet.SetMaxLogFileSize = function (v) {
1707
+ var Prop = 'MaxLogFileSize/';
1708
+ Prop = Prop + v;
1709
+ this.SigWebSetPropertySync(Prop);
1710
+ };
1711
+ SigWebTablet.GetSigSockServerPath = function () {
1712
+ var Prop = 'SigSockServerPath';
1713
+ Prop = Prop;
1714
+ return this.SigWebGetProperty(Prop);
1715
+ };
1716
+ SigWebTablet.GetSigSockClientName = function () {
1717
+ var Prop = 'SigSockClientName';
1718
+ Prop = Prop;
1719
+ return this.SigWebGetProperty(Prop);
1720
+ };
1721
+ SigWebTablet.GetSigSockPortNumber = function () {
1722
+ var Prop = 'SigSockPortNumber';
1723
+ Prop = Prop;
1724
+ return this.SigWebGetProperty(Prop);
1725
+ };
1726
+ SigWebTablet.SetSigSockServerPath = function (v) {
1727
+ var Prop = 'SigSockServerPath/';
1728
+ Prop = Prop + v;
1729
+ this.SigWebSetPropertySync(Prop);
1730
+ };
1731
+ SigWebTablet.SetSigSockClientName = function (v) {
1732
+ var Prop = 'SigSockClientName/';
1733
+ Prop = Prop + v;
1734
+ this.SigWebSetPropertySync(Prop);
1735
+ };
1736
+ SigWebTablet.SetPortNumber = function (v) {
1737
+ var Prop = 'PortNumber/';
1738
+ Prop = Prop + v;
1739
+ this.SigWebSetPropertySync(Prop);
1740
+ };
1741
+ SigWebTablet.SetSigSockPortNumber = function (v) {
1742
+ var Prop = 'SigSockPortNumber/';
1743
+ Prop = Prop + v;
1744
+ this.SigWebSetPropertySync(Prop);
1745
+ };
1746
+ SigWebTablet.GetFirmwareRevision = function () {
1747
+ var Prop = 'FirmwareRevision';
1748
+ Prop = Prop;
1749
+ return this.SigWebGetProperty(Prop);
1750
+ };
1751
+ SigWebTablet.SetTabletData = function (sigStr) {
1752
+ var Prop = 'TabletData';
1753
+ Prop = Prop;
1754
+ this.SigWebSetStreamProperty(Prop, sigStr);
1755
+ };
1756
+ SigWebTablet.GetTabletData = function () {
1757
+ var Prop = 'TabletData';
1758
+ Prop = Prop;
1759
+ var Str = this.SigWebGetProperty(Prop);
1760
+ return Str.slice(1, Str.length - 1);
1761
+ };
1762
+ SigWebTablet.OpenTablet = function (v) {
1763
+ var Prop = 'OpenTablet/';
1764
+ Prop = Prop + v;
1765
+ this.SigWebSetPropertySync(Prop);
1766
+ };
1767
+ SigWebTablet.CloseTablet = function () {
1768
+ var Prop = 'CloseTablet';
1769
+ Prop = Prop;
1770
+ this.SigWebSetProperty(Prop);
1771
+ };
1772
+ SigWebTablet.ResetParameters = function () {
1773
+ var Prop = 'ResetParameters';
1774
+ Prop = Prop;
1775
+ this.SigWebSetPropertySync(Prop);
1776
+ };
1777
+ SigWebTablet.testRawData = function () {
1778
+ this.OpenTablet(1);
1779
+ var Str1 = this.GetTabletData();
1780
+ this.CloseTablet();
1781
+ };
1782
+ SigWebTablet.SetTabletState = function (v, ctx, tv) {
1783
+ var _this = this;
1784
+ var delay;
1785
+ if (tv) {
1786
+ delay = tv;
1787
+ }
1788
+ else {
1789
+ delay = 100;
1790
+ }
1791
+ if (this.GetTabletState() != v) {
1792
+ if (v == 1) {
1793
+ if (ctx) {
1794
+ var can = ctx.canvas;
1795
+ this.SetDisplayXSize(can.width);
1796
+ this.SetDisplayYSize(can.height);
1797
+ this.SigWebSetDisplayTarget(ctx);
1798
+ }
1799
+ this.SetRealTabletState(v);
1800
+ var data = this.GetTabletState();
1801
+ var dataResult = data == '' || data == null ? 0 : Number(data);
1802
+ var tmr = null;
1803
+ if (ctx && dataResult != 0) {
1804
+ tmr = setInterval(function () { return _this.SigWebRefresh(); }, delay);
1805
+ }
1806
+ else {
1807
+ tmr = null;
1808
+ }
1809
+ return tmr;
1810
+ }
1811
+ else {
1812
+ if (ctx) {
1813
+ clearInterval(ctx);
1814
+ }
1815
+ this.SigWebSetDisplayTarget(null);
1816
+ this.SetRealTabletState(v);
1817
+ }
1818
+ }
1819
+ return null;
1820
+ };
1821
+ return SigWebTablet;
1822
+ }());
1823
+ SigWebTablet.baseUri = SigWebTablet.makeUri();
1824
+ SigWebTablet.Count = false;
1825
+ SigWebTablet.SigWebFontThreshold = 155;
1826
+ SigWebTablet.NumPointsLastTime = 0;
1827
+
1828
+ var OutputMessage = /** @class */ (function () {
1829
+ function OutputMessage() {
1830
+ }
1831
+ return OutputMessage;
1832
+ }());
1833
+ var LibeyNgSignatureComponent = /** @class */ (function () {
1834
+ function LibeyNgSignatureComponent() {
1835
+ this.OutputSignature = new i0.EventEmitter();
1836
+ this.DeviceType = 'mousepad';
1837
+ this._destroy$ = new rxjs.Subject();
1838
+ this.widthView = 500;
1839
+ this.heightView = 200;
1840
+ this.widthRender = 500;
1841
+ this.heightRender = 200;
1842
+ this.signaturePadOptions = {
1843
+ minWidth: 5,
1844
+ canvasWidth: this.widthView,
1845
+ canvasHeight: this.heightView,
1846
+ };
1847
+ this.FileValidated = false;
1848
+ this.NotDriver = false;
1849
+ this.UploadFile = null;
1850
+ }
1851
+ LibeyNgSignatureComponent.prototype.ngAfterViewInit = function () {
1852
+ this.InitDevice();
1853
+ };
1854
+ LibeyNgSignatureComponent.prototype.ngOnDestroy = function () {
1855
+ this.closingSigWeb();
1856
+ this._destroy$.next(true);
1857
+ };
1858
+ LibeyNgSignatureComponent.prototype.ChangeDevice = function () {
1859
+ var _this = this;
1860
+ this.NotDriver = false;
1861
+ this.UploadFile = null;
1862
+ this.File = null;
1863
+ setTimeout(function () {
1864
+ _this.InitDevice();
1865
+ }, 200);
1866
+ };
1867
+ LibeyNgSignatureComponent.prototype.InitDevice = function () {
1868
+ if (this.DeviceType == 'pinpad') {
1869
+ this.cnvContext = (this.canvas.nativeElement).getContext('2d');
1870
+ }
1871
+ if (this.DeviceType == 'mousepad') {
1872
+ this.signaturePad.set('minWidth', 5);
1873
+ this.signaturePad.clear();
1874
+ }
1875
+ };
1876
+ LibeyNgSignatureComponent.prototype.closingSigWeb = function () {
1877
+ SigWebTablet.ClearTablet();
1878
+ SigWebTablet.SetTabletState(0, this.tmr, null);
1879
+ };
1880
+ LibeyNgSignatureComponent.prototype.onSign = function () {
1881
+ this.NotDriver = false;
1882
+ this.UploadFile = null;
1883
+ var driver = SigWebTablet.GetVersionString();
1884
+ if (driver == null) {
1885
+ this.NotDriver = true;
1886
+ }
1887
+ else {
1888
+ this.NotDriver = false;
1889
+ console.log('onSign Clicked!');
1890
+ SigWebTablet.SetDisplayXSize(this.widthRender);
1891
+ SigWebTablet.SetDisplayYSize(this.heightRender);
1892
+ SigWebTablet.SetTabletState(0, this.tmr, null);
1893
+ SigWebTablet.SetJustifyMode(0);
1894
+ SigWebTablet.ClearTablet();
1895
+ if (this.tmr == null) {
1896
+ this.tmr = SigWebTablet.SetTabletState(1, this.cnvContext, 50);
1897
+ }
1898
+ else {
1899
+ SigWebTablet.SetTabletState(0, this.tmr, null);
1900
+ this.tmr = null;
1901
+ this.tmr = SigWebTablet.SetTabletState(1, this.cnvContext, 50);
1902
+ }
1903
+ }
1904
+ };
1905
+ LibeyNgSignatureComponent.prototype.onClear = function () {
1906
+ if (this.UploadFile == null) {
1907
+ if (this.DeviceType == 'pinpad') {
1908
+ SigWebTablet.ClearTablet();
1909
+ if (this.cnvContext) {
1910
+ this.cnvContext.clearRect(0, 0, this.canvas.nativeElement.width, this.canvas.nativeElement.height);
1911
+ }
1912
+ }
1913
+ if (this.DeviceType == 'mousepad') {
1914
+ this.signaturePad.clear();
1915
+ }
1916
+ }
1917
+ else {
1918
+ this.File = null;
1919
+ this.UploadFile = null;
1920
+ this.ChangeDevice();
1921
+ }
1922
+ };
1923
+ LibeyNgSignatureComponent.prototype.onDone = function () {
1924
+ var _this = this;
1925
+ var result = new OutputMessage();
1926
+ if (this.UploadFile == null) {
1927
+ if (this.DeviceType == 'pinpad') {
1928
+ // if (Number(SigWebTablet.NumberOfTabletPoints()) === 0) {
1929
+ // alert('Por favor firme antes de continuar');
1930
+ // } else {
1931
+ SigWebTablet.SetTabletState(0, this.tmr, null);
1932
+ SigWebTablet.SetSigCompressionMode(1);
1933
+ result.bioSigData = SigWebTablet.GetSigString();
1934
+ result.sigImgData = SigWebTablet.GetSigString();
1935
+ SigWebTablet.SetImageXSize(this.widthRender);
1936
+ SigWebTablet.SetImageYSize(this.heightRender);
1937
+ SigWebTablet.SetImagePenWidth(5);
1938
+ SigWebTablet.GetSigImageB64(function (base64) {
1939
+ result.sigString = "data:image/png;base64," + base64;
1940
+ _this.OutputSignature.emit(result);
1941
+ });
1942
+ // }
1943
+ }
1944
+ if (this.DeviceType == 'mousepad') {
1945
+ var result = new OutputMessage();
1946
+ result.sigString = this.signaturePad.toDataURL();
1947
+ this.OutputSignature.emit(result);
1948
+ }
1949
+ }
1950
+ else {
1951
+ result.sigString = this.UploadFile;
1952
+ this.OutputSignature.emit(result);
1953
+ }
1954
+ };
1955
+ LibeyNgSignatureComponent.prototype.fileEvent = function (event) {
1956
+ var _this = this;
1957
+ this.UploadFile = null;
1958
+ this.FileValidated = false;
1959
+ var file = event.target.files[0];
1960
+ if (file.type == 'image/jpeg' || file.type == 'image/png') {
1961
+ this.FileValidated = false;
1962
+ var newWidth = this.widthRender;
1963
+ var newHeight = this.heightRender;
1964
+ this.resizeImage(file, newWidth, newHeight)
1965
+ .then(function (resizedImageDataUrl) {
1966
+ _this.UploadFile = resizedImageDataUrl;
1967
+ })
1968
+ .catch(function (error) {
1969
+ console.error('Error al redimensionar la imagen:', error);
1970
+ });
1971
+ }
1972
+ else {
1973
+ this.File = null;
1974
+ this.UploadFile = null;
1975
+ this.FileValidated = true;
1976
+ }
1977
+ };
1978
+ LibeyNgSignatureComponent.prototype.resizeImage = function (image, newWidth, newHeight) {
1979
+ return new Promise(function (resolve, reject) {
1980
+ var reader = new FileReader();
1981
+ reader.onload = function (e) {
1982
+ var img = new Image();
1983
+ img.src = e.target.result;
1984
+ img.onload = function () {
1985
+ var canvas = document.createElement('canvas');
1986
+ var ctx = canvas.getContext('2d');
1987
+ canvas.width = newWidth;
1988
+ canvas.height = newHeight;
1989
+ ctx.drawImage(img, 0, 0, newWidth, newHeight);
1990
+ var resizedImageDataUrl = canvas.toDataURL(image.type);
1991
+ resolve(resizedImageDataUrl);
1992
+ };
1993
+ img.onerror = function (error) {
1994
+ reject(error);
1995
+ };
1996
+ };
1997
+ reader.readAsDataURL(image);
1998
+ });
1999
+ };
2000
+ return LibeyNgSignatureComponent;
2001
+ }());
2002
+ LibeyNgSignatureComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgSignatureComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
2003
+ LibeyNgSignatureComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: LibeyNgSignatureComponent, selector: "lib-libey-ng-signature", inputs: { DeviceType: "DeviceType" }, outputs: { OutputSignature: "OutputSignature" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["sigImg"], descendants: true }, { propertyName: "signaturePad", first: true, predicate: i1.SignaturePad, descendants: true }], ngImport: i0__namespace, template: "<div class=\"container\">\n <div *ngIf=\"UploadFile==null\">\n <div *ngIf=\"DeviceType=='pinpad'\" style=\"cursor: pointer; border: 1px ridge #d2d2d2;\">\n <canvas (click)=\"onSign()\" #sigImg [width]=\"widthView\" [height]=\"heightView\"></canvas> \n </div>\n <div *ngIf=\"DeviceType=='mousepad'\" style=\"border: 1px ridge #d2d2d2;\">\n <signature-pad [options]=\"signaturePadOptions\"></signature-pad>\n </div>\n </div>\n <div *ngIf=\"UploadFile!=null\" style=\"border: 1px ridge #d2d2d2;\">\n <img [src]=\"UploadFile\" [width]=\"widthView\" [height]=\"heightView\" />\n </div>\n</div>\n\n<div class=\"row\">\n <div class=\"col-md-12\">\n <input type=\"file\" (change)=\"fileEvent($event)\" [(ngModel)]=\"File\" class=\"form-control form-control-ph\"\n accept=\"image/png, image/jpeg\" style=\"width: 485px;\">\n <label *ngIf=\"FileValidated\" [ngClass]=\"'text-danger'\">Archivo requerido. Formatos permitidos (jpeg, jpg, png)</label>\n </div>\n</div>\n<div class=\"row\">\n <div class=\"col-md-6\">\n <ng-select [(ngModel)]=\"DeviceType\" class=\"ng-select\" placeholder=\"Seleccionar\" [clearable]=\"false\"\n (change)=\"ChangeDevice()\">\n <ng-option [value]=\"'pinpad'\">Pinpad</ng-option>\n <ng-option [value]=\"'mousepad'\">Mousepad</ng-option>\n </ng-select>\n <label *ngIf=\"NotDriver\" [ngClass]=\"'text-danger'\">No tiene el driver instalado</label>\n </div>\n <div class=\"col-md-6\">\n <p class=\"text-primary font-link-rp\" style=\"text-align: right; cursor: pointer;\" (click)=\"onClear()\">\n Limpiar firma\n </p>\n </div>\n</div>\n\n<div class=\"modal-footer mt-15 mb-4\">\n <button type=\"button\" class=\"btn btn-primary btn-save-rp\" (click)=\"onDone()\"> \n <i class=\"icon-save-white\"></i> Guardar\n </button>\n</div>", styles: [".container{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}\n"], components: [{ type: i1__namespace$1.SignaturePad, selector: "signature-pad", inputs: ["options"], outputs: ["onBeginEvent", "onEndEvent"] }, { type: i2__namespace.NgSelectComponent, selector: "ng-select", inputs: ["markFirst", "dropdownPosition", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "bufferAmount", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "bindLabel", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "virtualScroll", "openOnEnter", "appendTo", "bindValue", "appearance", "maxSelectedItems", "groupBy", "groupValue", "tabIndex", "typeahead"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { type: i2__namespace.ɵr, selector: "ng-option", inputs: ["disabled", "value"] }], directives: [{ type: i1__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
2004
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgSignatureComponent, decorators: [{
2005
+ type: i0.Component,
2006
+ args: [{
2007
+ selector: 'lib-libey-ng-signature',
2008
+ templateUrl: './libey-ng-signature.component.html',
2009
+ styleUrls: ['./libey-ng-signature.component.css'],
2010
+ }]
2011
+ }], ctorParameters: function () { return []; }, propDecorators: { OutputSignature: [{
2012
+ type: i0.Output
2013
+ }], DeviceType: [{
2014
+ type: i0.Input
2015
+ }], canvas: [{
2016
+ type: i0.ViewChild,
2017
+ args: ['sigImg', { static: false }]
2018
+ }], signaturePad: [{
2019
+ type: i0.ViewChild,
2020
+ args: [i1.SignaturePad]
2021
+ }] } });
2022
+
2023
+ var LibeyNgSignatureModule = /** @class */ (function () {
2024
+ function LibeyNgSignatureModule() {
2025
+ }
2026
+ return LibeyNgSignatureModule;
2027
+ }());
2028
+ LibeyNgSignatureModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgSignatureModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2029
+ LibeyNgSignatureModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgSignatureModule, declarations: [LibeyNgSignatureComponent], imports: [i4.FormsModule,
2030
+ i4.ReactiveFormsModule,
2031
+ i1.SignaturePadModule,
2032
+ i1$1.CommonModule,
2033
+ i2.NgSelectModule,
2034
+ ngBootstrap.NgbModule], exports: [LibeyNgSignatureComponent,
2035
+ i1.SignaturePadModule,
2036
+ i2.NgSelectModule,
2037
+ ngBootstrap.NgbModule] });
2038
+ LibeyNgSignatureModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgSignatureModule, imports: [[
2039
+ i4.FormsModule,
2040
+ i4.ReactiveFormsModule,
2041
+ i1.SignaturePadModule,
2042
+ i1$1.CommonModule,
2043
+ i2.NgSelectModule,
2044
+ ngBootstrap.NgbModule
2045
+ ], i1.SignaturePadModule,
2046
+ i2.NgSelectModule,
2047
+ ngBootstrap.NgbModule] });
2048
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgSignatureModule, decorators: [{
2049
+ type: i0.NgModule,
2050
+ args: [{
2051
+ declarations: [
2052
+ LibeyNgSignatureComponent
2053
+ ],
2054
+ imports: [
2055
+ i4.FormsModule,
2056
+ i4.ReactiveFormsModule,
2057
+ i1.SignaturePadModule,
2058
+ i1$1.CommonModule,
2059
+ i2.NgSelectModule,
2060
+ ngBootstrap.NgbModule
2061
+ ],
2062
+ exports: [
2063
+ LibeyNgSignatureComponent,
2064
+ i1.SignaturePadModule,
2065
+ i2.NgSelectModule,
2066
+ ngBootstrap.NgbModule
2067
+ ]
2068
+ }]
2069
+ }] });
2070
+
374
2071
  var LibeyNgComponentLibraryModule = /** @class */ (function () {
375
2072
  function LibeyNgComponentLibraryModule() {
376
2073
  }
377
2074
  return LibeyNgComponentLibraryModule;
378
2075
  }());
379
2076
  LibeyNgComponentLibraryModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgComponentLibraryModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
380
- LibeyNgComponentLibraryModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgComponentLibraryModule, imports: [i1.CommonModule,
381
- forms.FormsModule,
382
- LibeyNgTableModule], exports: [LibeyNgTableModule] });
383
- LibeyNgComponentLibraryModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgComponentLibraryModule, providers: [i1.DatePipe], imports: [[
384
- i1.CommonModule,
385
- forms.FormsModule,
386
- LibeyNgTableModule
387
- ], LibeyNgTableModule] });
2077
+ LibeyNgComponentLibraryModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgComponentLibraryModule, imports: [i1$1.CommonModule,
2078
+ i4.FormsModule,
2079
+ LibeyNgTableModule,
2080
+ LibeyNgSignatureModule,
2081
+ i1.SignaturePadModule], exports: [LibeyNgTableModule,
2082
+ LibeyNgSignatureModule,
2083
+ i1.SignaturePadModule] });
2084
+ LibeyNgComponentLibraryModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgComponentLibraryModule, providers: [i1$1.DatePipe], imports: [[
2085
+ i1$1.CommonModule,
2086
+ i4.FormsModule,
2087
+ LibeyNgTableModule,
2088
+ LibeyNgSignatureModule,
2089
+ i1.SignaturePadModule
2090
+ ], LibeyNgTableModule,
2091
+ LibeyNgSignatureModule,
2092
+ i1.SignaturePadModule] });
388
2093
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LibeyNgComponentLibraryModule, decorators: [{
389
2094
  type: i0.NgModule,
390
2095
  args: [{
391
2096
  declarations: [],
392
2097
  imports: [
393
- i1.CommonModule,
394
- forms.FormsModule,
395
- LibeyNgTableModule
2098
+ i1$1.CommonModule,
2099
+ i4.FormsModule,
2100
+ LibeyNgTableModule,
2101
+ LibeyNgSignatureModule,
2102
+ i1.SignaturePadModule
2103
+ ],
2104
+ exports: [
2105
+ LibeyNgTableModule,
2106
+ LibeyNgSignatureModule,
2107
+ i1.SignaturePadModule
396
2108
  ],
397
- exports: [LibeyNgTableModule],
398
- providers: [i1.DatePipe]
2109
+ providers: [i1$1.DatePipe]
399
2110
  }]
400
2111
  }] });
401
2112
 
@@ -407,12 +2118,37 @@
407
2118
  * Generated bundle index. Do not edit.
408
2119
  */
409
2120
 
2121
+ Object.defineProperty(exports, 'SignaturePad', {
2122
+ enumerable: true,
2123
+ get: function () { return i1.SignaturePad; }
2124
+ });
2125
+ Object.defineProperty(exports, 'SignaturePadModule', {
2126
+ enumerable: true,
2127
+ get: function () { return i1.SignaturePadModule; }
2128
+ });
2129
+ Object.defineProperty(exports, 'NgSelectModule', {
2130
+ enumerable: true,
2131
+ get: function () { return i2.NgSelectModule; }
2132
+ });
2133
+ Object.defineProperty(exports, 'NgbModule', {
2134
+ enumerable: true,
2135
+ get: function () { return ngBootstrap.NgbModule; }
2136
+ });
410
2137
  exports.LibeyColumnDirective = LibeyColumnDirective;
411
2138
  exports.LibeyNgComponentLibraryComponent = LibeyNgComponentLibraryComponent;
412
2139
  exports.LibeyNgComponentLibraryModule = LibeyNgComponentLibraryModule;
413
2140
  exports.LibeyNgComponentLibraryService = LibeyNgComponentLibraryService;
2141
+ exports.LibeyNgSignatureComponent = LibeyNgSignatureComponent;
2142
+ exports.LibeyNgSignatureModule = LibeyNgSignatureModule;
414
2143
  exports.LibeyNgTableComponent = LibeyNgTableComponent;
415
2144
  exports.LibeyNgTableModule = LibeyNgTableModule;
2145
+ exports.SigWebTablet = SigWebTablet;
2146
+ Object.keys(core).forEach(function (k) {
2147
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
2148
+ enumerable: true,
2149
+ get: function () { return core[k]; }
2150
+ });
2151
+ });
416
2152
 
417
2153
  Object.defineProperty(exports, '__esModule', { value: true });
418
2154