@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.
- package/CHANGELOG.md +9 -0
- package/dist/ej2-inputs.min.js +3 -3
- package/dist/ej2-inputs.umd.min.js +3 -3
- package/dist/ej2-inputs.umd.min.js.map +1 -1
- package/dist/es6/ej2-inputs.es2015.js +54 -34
- package/dist/es6/ej2-inputs.es2015.js.map +1 -1
- package/dist/es6/ej2-inputs.es5.js +54 -34
- package/dist/es6/ej2-inputs.es5.js.map +1 -1
- package/dist/global/ej2-inputs.min.js +3 -3
- package/dist/global/ej2-inputs.min.js.map +1 -1
- package/dist/global/index.d.ts +2 -2
- package/package.json +7 -7
- package/src/common/signature-base.d.ts +3 -1
- package/src/common/signature-base.js +53 -34
- package/src/uploader/uploader.js +1 -0
|
@@ -8997,6 +8997,7 @@ let Uploader = class Uploader extends Component {
|
|
|
8997
8997
|
let fileData = [];
|
|
8998
8998
|
if (!this.multiple) {
|
|
8999
8999
|
this.clearData(true);
|
|
9000
|
+
this.actionCompleteCount = 0;
|
|
9000
9001
|
targetFiles = [targetFiles[0]];
|
|
9001
9002
|
}
|
|
9002
9003
|
for (let i = 0; i < targetFiles.length; i++) {
|
|
@@ -13917,20 +13918,28 @@ class SignatureBase extends Component {
|
|
|
13917
13918
|
}
|
|
13918
13919
|
}
|
|
13919
13920
|
setHTMLProperties() {
|
|
13920
|
-
if (this.element.height === 150 && this.element.width === 300) {
|
|
13921
|
+
if (this.element.height === 150 && this.element.width === 300 && this.element.offsetHeight !== 0 && this.element.offsetWidth !== 0) {
|
|
13921
13922
|
this.element.height = this.element.offsetHeight;
|
|
13922
13923
|
this.element.width = this.element.offsetWidth;
|
|
13923
13924
|
this.isResponsive = true;
|
|
13924
13925
|
}
|
|
13925
|
-
else if (this.element.height !== this.element.offsetHeight - 1 || this.element.width !== this.element.offsetWidth - 1)
|
|
13926
|
+
else if ((this.element.height !== this.element.offsetHeight - 1 || this.element.width !== this.element.offsetWidth - 1)
|
|
13927
|
+
&& this.element.offsetHeight !== 0 && this.element.offsetWidth !== 0) {
|
|
13926
13928
|
this.element.height = this.element.offsetHeight;
|
|
13927
13929
|
this.element.width = this.element.offsetWidth;
|
|
13928
13930
|
}
|
|
13929
13931
|
this.canvasContext.scale(1, 1);
|
|
13930
13932
|
this.canvasContext.fillStyle = this.strokeColor;
|
|
13933
|
+
this.tempCanvas = this.createElement('canvas', { className: 'e-' + this.getModuleName() + '-temp' });
|
|
13934
|
+
this.tempContext = this.tempCanvas.getContext('2d');
|
|
13935
|
+
this.tempCanvas.width = this.element.width;
|
|
13936
|
+
this.tempCanvas.height = this.element.height;
|
|
13931
13937
|
if (this.backgroundImage) {
|
|
13932
13938
|
this.canvasContext.canvas.style.backgroundImage = 'url(' + this.backgroundImage + ')';
|
|
13933
13939
|
this.canvasContext.canvas.style.backgroundRepeat = 'no-repeat';
|
|
13940
|
+
if (this.saveWithBackground) {
|
|
13941
|
+
this.setBackgroundImage(this.backgroundImage, 'temp');
|
|
13942
|
+
}
|
|
13934
13943
|
}
|
|
13935
13944
|
else if (this.backgroundColor) {
|
|
13936
13945
|
this.canvasContext.canvas.style.backgroundColor = this.backgroundColor;
|
|
@@ -14036,7 +14045,7 @@ class SignatureBase extends Component {
|
|
|
14036
14045
|
}
|
|
14037
14046
|
}
|
|
14038
14047
|
beginStroke(e) {
|
|
14039
|
-
this.
|
|
14048
|
+
this.internalRefresh();
|
|
14040
14049
|
this.updateStroke(e);
|
|
14041
14050
|
}
|
|
14042
14051
|
updateStroke(e) {
|
|
@@ -14287,19 +14296,27 @@ class SignatureBase extends Component {
|
|
|
14287
14296
|
this.clearArray.push(this.incStep);
|
|
14288
14297
|
}
|
|
14289
14298
|
}
|
|
14290
|
-
setBackgroundImage(imageSrc) {
|
|
14299
|
+
setBackgroundImage(imageSrc, type) {
|
|
14291
14300
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
14292
14301
|
const proxy = this;
|
|
14293
14302
|
const imageObj = new Image();
|
|
14294
14303
|
imageObj.crossOrigin = 'anonymous';
|
|
14295
14304
|
imageObj.src = imageSrc;
|
|
14296
|
-
|
|
14297
|
-
|
|
14298
|
-
|
|
14299
|
-
|
|
14300
|
-
|
|
14301
|
-
}
|
|
14302
|
-
|
|
14305
|
+
if (type == 'temp') {
|
|
14306
|
+
imageObj.onload = () => {
|
|
14307
|
+
proxy.tempContext.globalCompositeOperation = 'source-over';
|
|
14308
|
+
proxy.tempContext.drawImage(imageObj, 0, 0, proxy.element.width, proxy.element.height);
|
|
14309
|
+
};
|
|
14310
|
+
}
|
|
14311
|
+
else {
|
|
14312
|
+
imageObj.onload = () => {
|
|
14313
|
+
proxy.canvasContext.globalCompositeOperation = 'source-over';
|
|
14314
|
+
proxy.canvasContext.drawImage(imageObj, 0, 0, proxy.element.width, proxy.element.height);
|
|
14315
|
+
proxy.updateSnapCollection();
|
|
14316
|
+
proxy.saveBackground(true);
|
|
14317
|
+
};
|
|
14318
|
+
this.canvasContext.clearRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
|
|
14319
|
+
}
|
|
14303
14320
|
}
|
|
14304
14321
|
setBackgroundColor(color) {
|
|
14305
14322
|
const canvasEle = this.canvasContext;
|
|
@@ -14355,16 +14372,21 @@ class SignatureBase extends Component {
|
|
|
14355
14372
|
a.click();
|
|
14356
14373
|
a.parentNode.removeChild(a);
|
|
14357
14374
|
}
|
|
14375
|
+
internalRefresh() {
|
|
14376
|
+
this.pointColl = [];
|
|
14377
|
+
this.lastVelocity = 0;
|
|
14378
|
+
this.lastWidth = (this.minStrokeWidth + this.maxStrokeWidth) / 2;
|
|
14379
|
+
}
|
|
14358
14380
|
/**
|
|
14359
14381
|
* To refresh the signature.
|
|
14360
14382
|
*
|
|
14361
|
-
* @private
|
|
14362
14383
|
* @returns {void}.
|
|
14363
14384
|
*/
|
|
14364
14385
|
refresh() {
|
|
14365
|
-
this.
|
|
14366
|
-
this.
|
|
14367
|
-
this.
|
|
14386
|
+
this.isResponsive = false;
|
|
14387
|
+
this.setHTMLProperties();
|
|
14388
|
+
this.resizeHandler();
|
|
14389
|
+
this.internalRefresh();
|
|
14368
14390
|
}
|
|
14369
14391
|
/**
|
|
14370
14392
|
* Erases all the signature strokes signed by user.
|
|
@@ -14374,7 +14396,7 @@ class SignatureBase extends Component {
|
|
|
14374
14396
|
clear() {
|
|
14375
14397
|
const args = { actionName: 'clear' };
|
|
14376
14398
|
this.canvasContext.clearRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
|
|
14377
|
-
this.
|
|
14399
|
+
this.internalRefresh();
|
|
14378
14400
|
this.signRatioPointsColl = [];
|
|
14379
14401
|
this.updateSnapCollection(true);
|
|
14380
14402
|
this.isSignatureEmpty = true;
|
|
@@ -14648,8 +14670,7 @@ class SignatureBase extends Component {
|
|
|
14648
14670
|
this.snapColl.pop();
|
|
14649
14671
|
this.incStep--;
|
|
14650
14672
|
}
|
|
14651
|
-
toSVG(fileName) {
|
|
14652
|
-
const dataUrl = this.canvasContext.canvas.toDataURL();
|
|
14673
|
+
toSVG(fileName, dataUrl) {
|
|
14653
14674
|
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
14654
14675
|
svg.setAttribute('width', this.canvasContext.canvas.width.toString());
|
|
14655
14676
|
svg.setAttribute('height', this.canvasContext.canvas.height.toString());
|
|
@@ -14690,27 +14711,23 @@ class SignatureBase extends Component {
|
|
|
14690
14711
|
* @returns {string}.
|
|
14691
14712
|
*/
|
|
14692
14713
|
getSignature(type) {
|
|
14714
|
+
if (this.saveWithBackground && this.backgroundColor && !this.backgroundImage) {
|
|
14715
|
+
this.tempContext.fillStyle = this.backgroundColor;
|
|
14716
|
+
this.tempContext.fillRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
|
|
14717
|
+
}
|
|
14718
|
+
else if (!this.backgroundColor && !this.backgroundImage && type === 'Jpeg') {
|
|
14719
|
+
this.tempContext.fillStyle = "#fff";
|
|
14720
|
+
this.tempContext.fillRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
|
|
14721
|
+
}
|
|
14722
|
+
this.tempContext.drawImage(this.element, 0, 0);
|
|
14693
14723
|
if (type === 'Jpeg') {
|
|
14694
|
-
|
|
14695
|
-
const data = imgData.data;
|
|
14696
|
-
for (let i = 0; i < data.length; i += 4) {
|
|
14697
|
-
if (data[i + 3] < 255) {
|
|
14698
|
-
data[i] = 255 - data[i];
|
|
14699
|
-
data[i + 1] = 255 - data[i + 1];
|
|
14700
|
-
data[i + 2] = 255 - data[i + 2];
|
|
14701
|
-
data[i + 3] = 255 - data[i + 3];
|
|
14702
|
-
}
|
|
14703
|
-
}
|
|
14704
|
-
this.canvasContext.putImageData(imgData, 0, 0);
|
|
14705
|
-
const dataURL = this.canvasContext.canvas.toDataURL('image/jpeg');
|
|
14706
|
-
this.resizeHandler();
|
|
14707
|
-
return dataURL;
|
|
14724
|
+
return this.tempCanvas.toDataURL('image/jpeg');
|
|
14708
14725
|
}
|
|
14709
14726
|
else if (type === 'Svg') {
|
|
14710
|
-
return this.toSVG(null);
|
|
14727
|
+
return this.toSVG(null, this.tempCanvas.toDataURL('image/png'));
|
|
14711
14728
|
}
|
|
14712
14729
|
else {
|
|
14713
|
-
return this.
|
|
14730
|
+
return this.tempCanvas.toDataURL('image/png');
|
|
14714
14731
|
}
|
|
14715
14732
|
}
|
|
14716
14733
|
/**
|
|
@@ -14765,6 +14782,9 @@ class SignatureBase extends Component {
|
|
|
14765
14782
|
case 'backgroundImage':
|
|
14766
14783
|
canvasNew.canvas.style.backgroundImage = 'url(' + value + ')';
|
|
14767
14784
|
this.backgroundImage = value;
|
|
14785
|
+
if (this.saveWithBackground) {
|
|
14786
|
+
this.setBackgroundImage(this.backgroundImage, 'temp');
|
|
14787
|
+
}
|
|
14768
14788
|
break;
|
|
14769
14789
|
case 'strokeColor':
|
|
14770
14790
|
canvasNew.fillStyle = value;
|