@syncfusion/ej2-inputs 23.1.36 → 23.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 23.1.36
4
- * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
3
+ * version : 23.1.38
4
+ * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
7
7
  * licensing@syncfusion.com. Any infringement will be prosecuted under
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-inputs@*",
3
- "_id": "@syncfusion/ej2-inputs@18.78.3",
3
+ "_id": "@syncfusion/ej2-inputs@23.1.36",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-NiJqjeQrct8TL4pr9tzbaRtGslss9anV9SOE/wroStN7DpkumSvV6Dm4PkSBAoDDruSR8zWuz4Y2JbqNeibDAw==",
5
+ "_integrity": "sha512-mfmW28CjudkKZtFp6LdVzq4O9EjFaTNWAFLQpfxlswginy3b/mkepd9petZl9BbWRQXvL2+4Aosxp1LPVP9k6w==",
6
6
  "_location": "/@syncfusion/ej2-inputs",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -39,8 +39,8 @@
39
39
  "/@syncfusion/ej2-schedule",
40
40
  "/@syncfusion/ej2-vue-inputs"
41
41
  ],
42
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-inputs/-/ej2-inputs-18.78.3.tgz",
43
- "_shasum": "d8087ab30bd22ee3335d37a4025a319dc08ab373",
42
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-inputs/-/ej2-inputs-23.1.36.tgz",
43
+ "_shasum": "16d99e65e26f114b27d7425cb3eb8b40912521b6",
44
44
  "_spec": "@syncfusion/ej2-inputs@*",
45
45
  "_where": "/jenkins/workspace/elease-automation_release_23.1.1/packages/included",
46
46
  "author": {
@@ -48,9 +48,9 @@
48
48
  },
49
49
  "bundleDependencies": false,
50
50
  "dependencies": {
51
- "@syncfusion/ej2-base": "~23.1.36",
51
+ "@syncfusion/ej2-base": "~23.1.38",
52
52
  "@syncfusion/ej2-buttons": "~23.1.36",
53
- "@syncfusion/ej2-popups": "~23.1.36",
53
+ "@syncfusion/ej2-popups": "~23.1.38",
54
54
  "@syncfusion/ej2-splitbuttons": "~23.1.36"
55
55
  },
56
56
  "deprecated": false,
@@ -119,7 +119,7 @@
119
119
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/inputs"
120
120
  },
121
121
  "typings": "index.d.ts",
122
- "version": "23.1.36",
122
+ "version": "23.1.38",
123
123
  "sideEffects": false,
124
124
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
125
125
  }
@@ -28,6 +28,8 @@ export declare abstract class SignatureBase extends Component<HTMLCanvasElement>
28
28
  private dotnetRef;
29
29
  private signPointsColl;
30
30
  private signRatioPointsColl;
31
+ private tempCanvas;
32
+ private tempContext;
31
33
  /**
32
34
  * Gets or sets the background color of the component.
33
35
  *
@@ -126,10 +128,10 @@ export declare abstract class SignatureBase extends Component<HTMLCanvasElement>
126
128
  */
127
129
  getBlob(url: string): Blob;
128
130
  private download;
131
+ private internalRefresh;
129
132
  /**
130
133
  * To refresh the signature.
131
134
  *
132
- * @private
133
135
  * @returns {void}.
134
136
  */
135
137
  refresh(): void;
@@ -85,20 +85,28 @@ var SignatureBase = /** @class */ (function (_super) {
85
85
  }
86
86
  };
87
87
  SignatureBase.prototype.setHTMLProperties = function () {
88
- if (this.element.height === 150 && this.element.width === 300) {
88
+ if (this.element.height === 150 && this.element.width === 300 && this.element.offsetHeight !== 0 && this.element.offsetWidth !== 0) {
89
89
  this.element.height = this.element.offsetHeight;
90
90
  this.element.width = this.element.offsetWidth;
91
91
  this.isResponsive = true;
92
92
  }
93
- else if (this.element.height !== this.element.offsetHeight - 1 || this.element.width !== this.element.offsetWidth - 1) {
93
+ else if ((this.element.height !== this.element.offsetHeight - 1 || this.element.width !== this.element.offsetWidth - 1)
94
+ && this.element.offsetHeight !== 0 && this.element.offsetWidth !== 0) {
94
95
  this.element.height = this.element.offsetHeight;
95
96
  this.element.width = this.element.offsetWidth;
96
97
  }
97
98
  this.canvasContext.scale(1, 1);
98
99
  this.canvasContext.fillStyle = this.strokeColor;
100
+ this.tempCanvas = this.createElement('canvas', { className: 'e-' + this.getModuleName() + '-temp' });
101
+ this.tempContext = this.tempCanvas.getContext('2d');
102
+ this.tempCanvas.width = this.element.width;
103
+ this.tempCanvas.height = this.element.height;
99
104
  if (this.backgroundImage) {
100
105
  this.canvasContext.canvas.style.backgroundImage = 'url(' + this.backgroundImage + ')';
101
106
  this.canvasContext.canvas.style.backgroundRepeat = 'no-repeat';
107
+ if (this.saveWithBackground) {
108
+ this.setBackgroundImage(this.backgroundImage, 'temp');
109
+ }
102
110
  }
103
111
  else if (this.backgroundColor) {
104
112
  this.canvasContext.canvas.style.backgroundColor = this.backgroundColor;
@@ -205,7 +213,7 @@ var SignatureBase = /** @class */ (function (_super) {
205
213
  }
206
214
  };
207
215
  SignatureBase.prototype.beginStroke = function (e) {
208
- this.refresh();
216
+ this.internalRefresh();
209
217
  this.updateStroke(e);
210
218
  };
211
219
  SignatureBase.prototype.updateStroke = function (e) {
@@ -456,19 +464,27 @@ var SignatureBase = /** @class */ (function (_super) {
456
464
  this.clearArray.push(this.incStep);
457
465
  }
458
466
  };
459
- SignatureBase.prototype.setBackgroundImage = function (imageSrc) {
467
+ SignatureBase.prototype.setBackgroundImage = function (imageSrc, type) {
460
468
  // eslint-disable-next-line @typescript-eslint/no-this-alias
461
469
  var proxy = this;
462
470
  var imageObj = new Image();
463
471
  imageObj.crossOrigin = 'anonymous';
464
472
  imageObj.src = imageSrc;
465
- imageObj.onload = function () {
466
- proxy.canvasContext.globalCompositeOperation = 'source-over';
467
- proxy.canvasContext.drawImage(imageObj, 0, 0, proxy.element.width, proxy.element.height);
468
- proxy.updateSnapCollection();
469
- proxy.saveBackground(true);
470
- };
471
- this.canvasContext.clearRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
473
+ if (type == 'temp') {
474
+ imageObj.onload = function () {
475
+ proxy.tempContext.globalCompositeOperation = 'source-over';
476
+ proxy.tempContext.drawImage(imageObj, 0, 0, proxy.element.width, proxy.element.height);
477
+ };
478
+ }
479
+ else {
480
+ imageObj.onload = function () {
481
+ proxy.canvasContext.globalCompositeOperation = 'source-over';
482
+ proxy.canvasContext.drawImage(imageObj, 0, 0, proxy.element.width, proxy.element.height);
483
+ proxy.updateSnapCollection();
484
+ proxy.saveBackground(true);
485
+ };
486
+ this.canvasContext.clearRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
487
+ }
472
488
  };
473
489
  SignatureBase.prototype.setBackgroundColor = function (color) {
474
490
  var canvasEle = this.canvasContext;
@@ -524,16 +540,21 @@ var SignatureBase = /** @class */ (function (_super) {
524
540
  a.click();
525
541
  a.parentNode.removeChild(a);
526
542
  };
543
+ SignatureBase.prototype.internalRefresh = function () {
544
+ this.pointColl = [];
545
+ this.lastVelocity = 0;
546
+ this.lastWidth = (this.minStrokeWidth + this.maxStrokeWidth) / 2;
547
+ };
527
548
  /**
528
549
  * To refresh the signature.
529
550
  *
530
- * @private
531
551
  * @returns {void}.
532
552
  */
533
553
  SignatureBase.prototype.refresh = function () {
534
- this.pointColl = [];
535
- this.lastVelocity = 0;
536
- this.lastWidth = (this.minStrokeWidth + this.maxStrokeWidth) / 2;
554
+ this.isResponsive = false;
555
+ this.setHTMLProperties();
556
+ this.resizeHandler();
557
+ this.internalRefresh();
537
558
  };
538
559
  /**
539
560
  * Erases all the signature strokes signed by user.
@@ -543,7 +564,7 @@ var SignatureBase = /** @class */ (function (_super) {
543
564
  SignatureBase.prototype.clear = function () {
544
565
  var args = { actionName: 'clear' };
545
566
  this.canvasContext.clearRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
546
- this.refresh();
567
+ this.internalRefresh();
547
568
  this.signRatioPointsColl = [];
548
569
  this.updateSnapCollection(true);
549
570
  this.isSignatureEmpty = true;
@@ -818,8 +839,7 @@ var SignatureBase = /** @class */ (function (_super) {
818
839
  this.snapColl.pop();
819
840
  this.incStep--;
820
841
  };
821
- SignatureBase.prototype.toSVG = function (fileName) {
822
- var dataUrl = this.canvasContext.canvas.toDataURL();
842
+ SignatureBase.prototype.toSVG = function (fileName, dataUrl) {
823
843
  var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
824
844
  svg.setAttribute('width', this.canvasContext.canvas.width.toString());
825
845
  svg.setAttribute('height', this.canvasContext.canvas.height.toString());
@@ -860,27 +880,23 @@ var SignatureBase = /** @class */ (function (_super) {
860
880
  * @returns {string}.
861
881
  */
862
882
  SignatureBase.prototype.getSignature = function (type) {
883
+ if (this.saveWithBackground && this.backgroundColor && !this.backgroundImage) {
884
+ this.tempContext.fillStyle = this.backgroundColor;
885
+ this.tempContext.fillRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
886
+ }
887
+ else if (!this.backgroundColor && !this.backgroundImage && type === 'Jpeg') {
888
+ this.tempContext.fillStyle = "#fff";
889
+ this.tempContext.fillRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
890
+ }
891
+ this.tempContext.drawImage(this.element, 0, 0);
863
892
  if (type === 'Jpeg') {
864
- var imgData = this.canvasContext.getImageData(0, 0, this.element.width, this.element.height);
865
- var data = imgData.data;
866
- for (var i = 0; i < data.length; i += 4) {
867
- if (data[i + 3] < 255) {
868
- data[i] = 255 - data[i];
869
- data[i + 1] = 255 - data[i + 1];
870
- data[i + 2] = 255 - data[i + 2];
871
- data[i + 3] = 255 - data[i + 3];
872
- }
873
- }
874
- this.canvasContext.putImageData(imgData, 0, 0);
875
- var dataURL = this.canvasContext.canvas.toDataURL('image/jpeg');
876
- this.resizeHandler();
877
- return dataURL;
893
+ return this.tempCanvas.toDataURL('image/jpeg');
878
894
  }
879
895
  else if (type === 'Svg') {
880
- return this.toSVG(null);
896
+ return this.toSVG(null, this.tempCanvas.toDataURL('image/png'));
881
897
  }
882
898
  else {
883
- return this.canvasContext.canvas.toDataURL('image/png');
899
+ return this.tempCanvas.toDataURL('image/png');
884
900
  }
885
901
  };
886
902
  /**
@@ -935,6 +951,9 @@ var SignatureBase = /** @class */ (function (_super) {
935
951
  case 'backgroundImage':
936
952
  canvasNew.canvas.style.backgroundImage = 'url(' + value + ')';
937
953
  this.backgroundImage = value;
954
+ if (this.saveWithBackground) {
955
+ this.setBackgroundImage(this.backgroundImage, 'temp');
956
+ }
938
957
  break;
939
958
  case 'strokeColor':
940
959
  canvasNew.fillStyle = value;
@@ -1279,6 +1279,7 @@ var Uploader = /** @class */ (function (_super) {
1279
1279
  var fileData = [];
1280
1280
  if (!this.multiple) {
1281
1281
  this.clearData(true);
1282
+ this.actionCompleteCount = 0;
1282
1283
  targetFiles = [targetFiles[0]];
1283
1284
  }
1284
1285
  for (var i = 0; i < targetFiles.length; i++) {